Is it possible to automate replacing .png files in Acrobat?
I design labels and the template from one manufacturer is only available in .pdf format. In order to change the design (e.g. different names of the same product) for the smaller labels I have to right click, ctrl+r, select the new .png 30-odd times, and that's just in one file! Not only does it take ages, it's driving me mental...
Is there any way of recording a macro or writing a script so I can select the file I want to replace the .png with and have it do all the labels in the file at once?
EDIT: Word template
PDF template
Normally the label manufacturer supplies software and office templates for the labels so here I downloaded 1" circles into WordPad but normally MS office includes suitable templates.
You simply print the box contents as required, The inputs in Word can be from Word MailMerge, Access Database or via eXcel OLE/CSV outputs.
A very similar method can be used with PDF templates but on downloading an Avery PDF template I did not see similar Input fields. So in Acrobat you would need to add a set to one template. Export the FDF file with the numbers, probably as two lines if thats what you need. Then filling the FDF template as required you doubleclick the FDF file and it imports into the master PDF for "save as" or print as.
The extra work for FDF would only pay dividends for thousands of programable entries and potentially require several alternative routes. It is much simpler to use the MS Word(Pad) version with any convenient import macro.
For PNG imports you could simply use an HTML template and print to PDF (that can be done command line headless if needing to run thousands at a time, Printing the PDF to printer is a different question :-)
Note I have used 0-9 for illustration but you can adjust for all 30 as you wish.
A rough template could look something like this, there is surplus to your needs but adjust the values as you require, mine are set to A4 no margins.
<!DOCTYPE html>
<html>
<head>
<style>
#page {
width:795;
height:1124;
}
table {
margin: 0 auto; /* or margin: 0 auto 0 auto */
font-family: arial, sans-serif;
width: 90%;
padding-top:10px;
}
td {
width: 20%;
border: 0px;
text-align:center
padding-top:5px;
padding-bottom:5px;
padding-left:5px;
padding-right:5px;
}
tr {
border: 0px;
text-align: center;
}
</style>
</head>
<body>
<table>
<tr>
<td><img src="000.png" width="133" height="170"></td>
<td><img src="001.png" width="133" height="170"></td>
<td><img src="002.png" width="133" height="170"></td>
<td><img src="003.png" width="133" height="170"></td>
<td><img src="004.png" width="133" height="170"></td>
</tr>
<tr>
<td><img src="005.png" width="133" height="170"></td>
<td><img src="006.png" width="133" height="170"></td>
<td><img src="007.png" width="133" height="170"></td>
<td><img src="008.png" width="133" height="170"></td>
<td><img src="009.png" width="133" height="170"></td>
</tr>
<tr>
<td><img src="010.png" width="133" height="170"></td>
<td><img src="011.png" width="133" height="170"></td>
<td><img src="012.png" width="133" height="170"></td>
<td><img src="013.png" width="133" height="170"></td>
<td><img src="014.png" width="133" height="170"></td>
</tr>
<tr>
<td><img src="015.png" width="133" height="170"></td>
<td><img src="016.png" width="133" height="170"></td>
<td><img src="017.png" width="133" height="170"></td>
<td><img src="018.png" width="133" height="170"></td>
<td><img src="019.png" width="133" height="170"></td>
</tr>
<tr>
<td><img src="020.png" width="133" height="170"></td>
<td><img src="021.png" width="133" height="170"></td>
<td><img src="022.png" width="133" height="170"></td>
<td><img src="023.png" width="133" height="170"></td>
<td><img src="024.png" width="133" height="170"></td>
</tr>
<tr>
<td><img src="025.png" width="133" height="170"></td>
<td><img src="026.png" width="133" height="170"></td>
<td><img src="027.png" width="133" height="170"></td>
<td><img src="028.png" width="133" height="170"></td>
<td><img src="029.png" width="133" height="170"></td>
</tr>
</table>
</body>
</html>
Related
I use cfdocument and I need to remove bottom-padding from my table.
<cfdocument format="pdf">
<!DOCTYPE html>
<html>
<head>
<style>
table {
font-family: arial, sans-serif;
border-collapse: collapse;
width: 100%;
}
</style>
</head>
<body>
<h2>HTML Table</h2>
<table bgcolor="red">
<tr>
<th>Company</th>
<th>Contact</th>
<th>Country</th>
</tr>
<tr>
<td>Alfreds Futterkiste</td>
<td>Maria Anders</td>
<td>Germany</td>
</tr>
<tr>
<td>Centro comercial Moctezuma</td>
<td>Francisco Chang</td>
<td>Mexico</td>
</tr>
<tr>
<td>Ernst Handel</td>
<td>Roland Mendel</td>
<td>Austria</td>
</tr>
<tr>
<td>Island Trading</td>
<td>Helen Bennett</td>
<td>UK</td>
</tr>
<tr>
<td>Laughing Bacchus Winecellars</td>
<td>Yoshi Tannamuri</td>
<td>Canada</td>
</tr>
<tr>
<td style="padding-bottom: 0px;" cellspacing="0">Magazzini Alimentari Riuniti</td>
<td style="padding-bottom: 0px;" cellspacing="0">Giovanni Rovelli</td>
<td style="padding-bottom: 0px;" cellspacing="0">Italy</td>
</tr>
</table>
</body>
</html>
</cfdocument>
I need to remove the bottom padding (yellow vertical line)
I use padding-bottom: 0px; but didn't worked. There is cellspacing="0" but it will affect entire table.
cffiddle : https://cffiddle.org/app/file?filepath=7b8c6141-8bac-42f5-a653-71ddce64c554/fe42c362-17cb-4810-b532-64e11d98685a/c885261b-341d-4ea2-b6d8-3c55687094ec.cfm
I want to retrieve an item from a SharePoint Online list (Office 365) and print it out in a form format. I have looked at a few ways which involve using power automate and third party tools which such as Muhimbi and Encodian to put the item's values into a HTML form template and convert and download the as a PDF. However this solution requires paying for the third party apps which is extremely expensive. Is there anyway that I can work around this. Are there any other methods of generating and printing the form with the values of the SharePoint list item ?
Oh wow. I have a ready made answer for this. Here is how I implemented a print function from within powerapps & flow. No extra addons or anything. Just a printer with email and a simple understanding of HTML and powerapps.
Here is the article to get the printer to print: https://powerusers.microsoft.com/t5/Building-Power-Apps/Automatic-Printing-using-Flow-and-a-copier-this-is-a-workaround/m-p/556375
and: https://powerusers.microsoft.com/t5/Power-Automate-Community-Blog/Printing-Documents-Automatically-Using-Power-Automate/bc-p/1636135#M1401
Setting up the HTML is the hardest part. I did it easily by using Notepad ++ in HTML language mode. Then plugging in the variables after copy pasting to powerapps collect. Here is one of the snips of my code:
UpdateContext({PrintStatus:1});'ProcessWorkOrder-2'.Run("<!DOCTYPE html>
<html>
<head>
<title>TicketNumber."
&Text(dcvTicketID)&"
."& Text(dcvCustomerName)&"
</title>
<style>
div.ltr {
background-color: white;
}
#head {
display: flex;
justify-content: space-between;
padding: 5%;
}
#head div {
width: 50%;
}
.head {
display: flex;
background-color: white;
}
.head > div {
padding: 20px;
}
div.border {
border: 1px solid #333;
text-align: right;
}
table.cdata {
position: relative;
left: 0.25in;
top: 0.25in;
}
table.cdata1 {
position: relative;
margin-left: 5%;
margin-right: 5%;
top: 0.25in;
width: 90%;
}
table,
td, th {
border: 1px solid #333;
}
thead,
tfoot {
background-color: #99ebff;
color: black;
}
.bold {
font-size: 25px;
}
img {
border: 2px;
}
p {
white-space:pre-wrap;
}
</style>
</head>
<body>
<br><br>
<div class='ltr'>
<div >
<div>
<table class='cdata1'>
<thead>
<tr><th class='bold' colspan='2'><strong>Duplicate Print Job</strong></th></tr>
</thead>
</table>
</div>
</div>
<br><br>
<div >
<div>
<table class='cdata1'>
<thead>
<tr><th class='bold' colspan='2'><strong>Ticket Information:</strong></th></tr>
</thead>
<tr><td>Ticket ID: </td><td> "&Text(dcvTicketID)&"</td></tr>
<tr><td>Chargeable Call: </td><td> "&If(tgIsChargeableCall.Value=true,"Yes, This is a chargeable call","No")&"</td></tr>
<tr><td>Has Been Invoiced: </td><td> "&If(tgBeenInvoiced.Value=true,"Yes,This has been invoiced","No")&"</td></tr>
<tr><td>Invoice Number: </td><td> "&Text(dcvInvoiceNumber)&"</td></tr>
<tr><td>Customer P.O. Number: </td><td> "&Text(DataCardValue38)&"</td></tr>
<tr><td>Ticket Status: </td><td> "&Text(ddStatus.Selected.Value)&"</td></tr>
<tr><td>Call Type: </td><td> "&dcvCallType.Selected.Value&"</td></tr>
<tr><td>Date Completed: </td><td> "&Text(dcvDateClosed)&"</td></tr>
<tr><td>Closed By: </td><td> "&Text(dcvClosedBy)&"</td></tr>
</table>
</div>
</div>
<br><br>
<div >
<div>
<table class='cdata1'>
<thead>
<tr><th class='bold' colspan='2'><strong>Customer Information:</strong></th></tr>
</thead>
<tr><td>Customer Name: </td><td> "&Text(dcvCustomerName)&"</td></tr>
<tr><td>Office Branch: </td><td> "&Text(dcvBranchName)&"</td></tr>
<tr><td>Location: </td><td> "&Text(dcvLocationName)&"</td></tr>
<tr><td>Make: </td><td> "&Text(dcvMake)&"</td></tr>
<tr><td>Model: </td><td> "&Text(dcvModel)&"</td></tr>
<tr><td>Serial Number: </td><td> "&Text(dcvSerialNumber)&"</td></tr>
<tr><td>Total Counter: </td><td> "&Text(dcvTotalCounter,"[$-en-US]#,###")&"</td></tr>
<tr><td>Black Counter: </td><td> "&Text(dcvBWCounter,"[$-en-US]#,###")&"</td></tr>
</table>
</div>
</div>
<br><br>
<div class='problem'>
<table class='cdata1'>
<thead>
<tr>
<th class='bold'><strong>Problem Description:</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>"&dcvProblem.Text&"</p>
</td>
</tr>
</tbody>
</table>
</div>
<br><br>
<div class='solution'>
<table class='cdata1'>
<thead>
<tr>
<th class='bold'><strong>Solution:</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>"&dcvRichText.HtmlText&"</p>
</td>
</tr>
</tbody>
</table>
</div>
<br><br>
<div class='visits'>
<table class='cdata1'>
<thead>
<tr>
<th class='bold' colspan='4'>Visits:</th>
</tr>
<tr><th>Date</th><th>Time In</th><th>Time Out</th><th>Total</th></tr></thead>
<tbody>"& Concat(ItemGallery_8.AllItems, "<tr><td>"& Date &"</td><td>" & StartTime & "</td><td>" &EndTime&"</td><td>"&Value(Total)&"</td></tr>") &"</tbody><tfoot><tr><td class='bold' colspan='3'><strong>Total Time On-Site:</strong></td><td><strong>"& Sum(ItemGallery_8.AllItems, Total) &"</strong></td></tr></tfoot></table>
</div>
<br><br>
<div class='charges'>
<table class='cdata1'>
<thead>
<tr>
<th class='bold' colspan='5'><strong>Chargeable Items:</strong></th>
</tr>
<tr><th>Item Type</th><th>Quantity</th><th>Description</th><th>Cost Per Item</th><th>Total</th></tr></thead>
<tbody>"& Concat(GalleryChargeableItems.AllItems, "<tr><td>"& ItemType &"</td><td>" & Quantity & "</td><td>" &ItemName&"</td><td>"&Text(Value(CostPerItem),"[$-en-US]$#,###.00")&"</td><td>"&Text(Value(SubTotalCost),"[$-en-US]$#,###.00")&"</td></tr>") &"</tbody>
<tfoot>
<tr>
<td class='bold' colspan='4'><strong>Total Cost:</strong></td>
<td><strong>" & Text(Sum(GalleryChargeableItems.AllItems, SubTotalCost ), "[$-en-US]$#,###.00")&"</strong></td>
</tr>
</tfoot>
</table>
</div>
<br><br>
<div class='charges'>
<table class='cdata1'>
<thead>
<tr>
<th class='bold' colspan='2'><strong>Toners Delivered:</strong></th>
</tr>
<tr><th>Color</th><th>Quantity</th></tr></thead>
<tbody><tr><td>Black</td><td>" &Text(TK)&"</td></tr><tr><td>Cyan</td><td>"&Text(TC)&"</td></tr><tr><td>Magenta</td><td>"&Text(TM)&"</td></tr><tr><td>Yellow</td><td>"&Text(TY)&"</td></tr></tbody>
</table>
</div>
<br><br>
<div class='solution'>
<table class='cdata1'>
<thead>
<tr>
<th class='bold'><strong>Notes About Toner:</strong></th>
</tr>
</thead>
<tbody>
<tr>
<td>
<p>"&dcvTonerNotes.Text&"</p>
</td>
</tr>
</tbody>
</table>
</div>
<br><br>
<div class='signature'>
<table class='cdata1'>
<thead>
<tr>
<th class='bold'><strong>Signed By: "& SignersName.Text &"</strong></th></tr></thead>
<tr>
<td><img src=" & JSON(Sinature.Image,JSONFormat.IgnoreBinaryData) & " width='450px'></td></tr></table></div></div><br><br><br><br></body></html>","Print_Job_"&Text(dcvTicketID)&"_WO_"&Text(Now(),"[$-en-US]mm.dd.yyyy_hh.mm.ss"))
Here is the flow to make the HTML doc and convert it to PDF:
Here is the flow to send the email with the attached pdf to the printer:
You could morph my solution to do your own thing. I would suggest automating converting your list to a csv using flow and then converting it to PDF. Most modern printers support Email, and will allow printing of attached PDFS. Kyocera is the brand I recommend using. But I think brother also allows this without having to buy extra stuff. There is also a python library out there that would let you send info to a printer.
Overview:
I'm trying to get 2 tables to be aligned side by side. In another thread I found out that you can do that using display:inline-table or float: left. However when I added these elements to my CSS, nothing happens.
Here is how my code looks at the moment (also, apologies if my code is messy):
<html>
<head>
<meta charset="utf-8">
<style>
body {
background-color:#FFFFFF;
}
table {
float: left;
font-family: tahoma, sans-serif;
border-collapse: collapse;
width: 100%;
}
td, th {
border: 0px solid #dddddd;
text-align: left;
padding: 8px;
}
tr:nth-child(even) {
background-color: #dddddd;
}
tr:hover {background-color:#FFDB80;}
</style>
</head>
<body>
<table cellpadding="10" cellspacing="0" style="height: 100px; font-family:tahoma;">
<tbody>
<tr>
<td colspan="3" width="700px" valign="center" bgcolor="#192A34" style="color:white;"><font size="4">LIST OF ISBT 128 STANDARDS</font></td>
<td width="100px" valign="center" bgcolor="#192A34" style="color:white;"><font size="2"> 05 Nov 2018</font></td>
</tr>
<tr>
<td width="100px" valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Identification</font></td>
<td width="600" valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Document Title</font></td>
<td width="100" valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Active Version</font></td>
<td valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Date Issued</font></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><font size="2">ST-001</font></td>
<td><font size="2">ISBT 128 Standard Technical Specification</font></td>
<td><font size="2">5.10.0</font></td>
<td><font size="2"> Jan 2019</font></td>
</tr>
</tbody>
</table>
<table cellpadding="10" cellspacing="0" style="height: 100px; font-family:tahoma;">
<tbody>
<tr>
<td colspan="3" width="700px" valign="center" bgcolor="#192A34" style="color:white;"><font size="4">LIST OF ISBT 128 TECHNICAL BULLETINS</font></td>
<td width="100px" valign="center" bgcolor="#192A34" style="color:white;"><font size="2"> 05 Nov 2018</font></td>
</tr>
<tr>
<td width="100px" valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Identification</font></td>
<td width="600" valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Document Title</font></td>
<td width="100" valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Active Version</font></td>
<td valign="center" bgcolor="#941A1D" style="color:white;"><font size="2">Date Issued</font></td>
</tr>
<tr>
<td> </td>
</tr>
<tr>
<td><font size="2">TB-001</font></td>
<td><font size="2">Implementing ISBT 128: Guidance on Handling non-ISBT 128 Labeled Collections</font></td>
<td><font size="2">5.10.0</font></td>
<td><font size="2"> Jan 2019</font></td>
</tr>
</tbody>
</table>
</body>
</html>
I suspect it has something to do with a lot of the td width elements and other html elements I injected into the table. I'm still a beginner so any suggestions are welcome to clean up the code.
You have your width set on the tables as 100% so each of them is taking up the full width of the browser and they can't fit side by side. Reduce that to 50% and you'll see that works.
Note: <font>, valign and bgcolor have been obsolete for many years. Do not use them.
I'm working on a responsive email template, and I really would like a table layout for featured products, 3x2 on desktop, 2x3 on mobile.
Currently, I am using a table with cells that change to display as inline-block for mobile clients. However, this breaks in Outlook and Thunderbird, as they display all cells in a single row. I have tried floating the elements, but again they break.
Table Grid 3x2 to 2x3
CSS
#media screen and (max-width: 600px) {
.stack2 {
width: 50% !important;
}
}
.stack2 {
display: inline-block;
box-sizing: border-box;
}
HTML
<table width="100%" cellpadding="0px" cellspacing="0px" border="0px">
<tr>
<!-- Product #1 -->
<td class="stack2" width="33.33%" style="padding:20px;">
</td>
<!-- Product #2 -->
<td class="stack2" width="33.33%" style="padding:20px;">
</td>
<!-- Product #3 -->
<td class="stack2" width="33.33%" style="padding:20px;">
</td>
<!-- Product #4 -->
<td class="stack2" width="33.33%" style="padding:20px;">
</td>
<!-- Product #5 -->
<td class="stack2" width="33.33%" style="padding:20px;">
</td>
<!-- Product #6 -->
<td class="stack2" width="33.33%" style="padding:20px;">
</td>
</tr>
</table>
Don't use table cells for this. Cells will continue to stack side by side in a row and that is their natural and intended behaviour.
The only way for a table cell to appear underneath others, would be in another row.
Your implementation goes against HTML logic.
I would go with tables for this instead. That way they will easily stack and rearrange depending on the width you give them. Just bear in mind that you will need to use ghost tables to make the tables sit side by side in Outlook.
Here is a loose example (Ghost tables included) for you to adapt to work for you:
<table border="0" cellspacing="0" cellpadding="0" class="FullWidthOnMobile" style="width:600px;">
<tr>
<td>
<!--[if (gte mso 9)|(IE)]>
<table border="0" cellspacing="0" cellpadding="0" style="width:100%;">
<tr>
<td style="width:200px;">
<![endif]-->
<table align="left" border="0" cellspacing="0" cellpadding="0" class="HalfWidthOnMobile" style="width:200px;">
<tr>
<td bgcolor="red" style="padding:10px 0; border:1px solid #fff;"> </td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
<td>
<![endif]-->
<table align="left" border="0" cellspacing="0" cellpadding="0" class="HalfWidthOnMobile" style="width:200px;">
<tr>
<td bgcolor="red" style="padding:10px 0; border:1px solid #fff;"> </td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
<td style="width:200px;">
<![endif]-->
<table align="left" border="0" cellspacing="0" cellpadding="0" class="HalfWidthOnMobile" style="width:200px;">
<tr>
<td bgcolor="red" style="padding:10px 0; border:1px solid #fff;"> </td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
<tr>
<td style="width:200px;">
<![endif]-->
<table align="left" border="0" cellspacing="0" cellpadding="0" class="HalfWidthOnMobile" style="width:200px;">
<tr>
<td bgcolor="red" style="padding:10px 0; border:1px solid #fff;"> </td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
<td>
<![endif]-->
<table align="left" border="0" cellspacing="0" cellpadding="0" class="HalfWidthOnMobile" style="width:200px;">
<tr>
<td bgcolor="red" style="padding:10px 0; border:1px solid #fff;"> </td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
<td style="width:200px;">
<![endif]-->
<table align="left" border="0" cellspacing="0" cellpadding="0" class="HalfWidthOnMobile" style="width:200px;">
<tr>
<td bgcolor="red" style="padding:10px 0; border:1px solid #fff;"> </td>
</tr>
</table>
<!--[if (gte mso 9)|(IE)]>
</td>
</tr>
</table>
<![endif]-->
</td>
</tr>
Media queries I used. Again adapt these as I named for simplicity of understanding what I'm doing:
#media only screen and (max-width:600px){
.FullWidthOnMobile{width:100%!important;min-width:100%!important;}
.HalfWidthOnMobile{width:50%!important;min-width:50%!important;}
}
I have a crawl data from a web page. I want to get some data from the HTML Code, how can I do that?
Some Example of crawl data:
<table width="272" cellpadding="5" cellspacing="0" class="floatleft" style="border-right:1px dotted #BFBFBF">
<tr>
<td width="130" class="paymentlabel"><strong>Transfer Fee</strong></td>
<td width="120"> $11 </td>
<td><img src="http://i.i-sgcm.com/used_cars/qmark_red_18x18.png" width="18" height="18" /></td>
</tr>
<tr>
<td class="paymentlabel" valign="top"><strong>Down Payment</strong></td>
<td> $47,444 (change) <p style="line-height:14px;"><span class="font_gray">Maximum 50% Loan</span></p> </td>
<td><img src="http://i.i-sgcm.com/used_cars/qmark_red_18x18.png" width="18" height="18" /></td>
</tr>
<tr>
<td class="paymentlabel"><strong>1st Instalment</strong></td>
<td> $901 </td>
<td><img src="http://i.i-sgcm.com/used_cars/qmark_red_18x18.png" width="18" height="18" /></td>
</tr>
<tr bgcolor="#FFF4F4">
<td class="paymentlabel" valign="top"><strong>Total</strong></td>
<td valign="top"> <strong class="font_red"> $48,356<br /><span class="font_gray" style="font-weight:normal;">(excluding insurance)</span> </strong> </td>
<td><img src="http://i.i-sgcm.com/used_cars/qmark_red_18x18.png" width="18" height="18" /></td>
</tr>
<tr>
<td class="font_gray font_10" colspan="3" style="padding:7px 0 7px 5px; line-height:12px;">Estimates based on 50% loan at 2.80% interest rate. <br />Check with seller for exact figure.</td>
</tr>
</table>
Controller for crawler:
HttpWebRequest request = (HttpWebRequest)HttpWebRequest.Create(url);
request.UserAgent = "A .NET Web Crawler";
WebResponse response = request.GetResponse();
Stream stream = response.GetResponseStream();
StreamReader reader = new StreamReader(stream);
string htmlText = reader.ReadToEnd();
return htmlText;
I want to get the value of Transfer Fee (i.e $11), value of Down Payment (i.e $47,444), value of 1st Instalment (i.e $901) and the value of Total (i.e $48,356). Is it possible to do that?? Thanks for help!!
Yes you can. You need a library the loads the html and allows you to query what you need. Try one or all of the following that allow you to do exactly that...
CsQuery
Anglesharp
Html Agility Pack