I am looking to print a PDF document automatically...
# general
l
I am looking to print a PDF document automatically when a fulfillment is marked as shipped. It is a static document that for now is stored in a custom document field on that fulfillment. Alternatively, any thoughts on how I might automatically append that PDF to a pick ticket at time of printing? I know that's built for BOM docs but haven't stumbled across that capability for pick tickets. Just want to see if I'm missing anything available before I get creative.
t
@Leo Galey, that is definitely doable but would require some scripting. I’ve done a lot of automations around auto generating PDFs and storing them with records as well as appending two PDFs together, so let me know if you need some guidance or help.
l
Thank you. I'm probably capable of creating the scripting but yes any guidance to remove the stumbling around at the beginning would be helpful. To give better explanation - I am going to import Amazon-provided packing lists to the sales order record and want to print them alongside pick ticket (and bulk print those pick tickets)
j
Hey @Leo Galey we've done something like this - actually pulling from a variable what PDFs to append to the template at the time it's printed. We do it using
<pdfset>
like this:
Copy code
<?xml version="1.0"?><!DOCTYPE pdf PUBLIC "-//big.faceless.org//report" "report-1.1.dtd">
<pdfset>
<pdf>

XML of your main template goes here...

<pdf>

<#include "<https://link_to_pdf_in_file_cabinet>"/>

</pdfset>
we don't use pick tickets but maybe this idea will help?
l
Outstanding, I'm not too familiar with the BFO syntax but I will see if I can make that link dynamic and try it. Thanks
j
Ours actually looks something like this:
Copy code
<#include "<https://system.netsuite.com/core/media/media.nl?id=${doc.id}&c=${doc.c}&h=${doc.h}&_xt=${doc._xt}>"/>
l
OK thank you!
@jen This is probably my own lack of knowledge on these advanced templates/freemarker, but <#include> seems to be expecting a .tpl file rather than a PDF?
.ftl, rather.
j
oh shoot, yeah it's an XML file where we use it
I'm sure I've done something similar to include actual .pdfs though
l
No worries, just glad I wasn't missing something boneheaded
j
Copy code
<pdfset>

<pdf>

your template

</pdf>

<pdf>
<pdf src="path_to_your_included_pdf"/>
</pdf>

</pdfset>`
something like this maybe
l
Well documentation for pdfset shows essentially what you suggested but getting Error on line 174, column 77 in template. Detail... The reference to entity "c" must end with the ';' delimiter.
And hey I really appreciate it, I'll take all the help I can get but not trying to get you to troubleshoot it for me
Using a different PDF file produces no error, haven't tested yet but I suppose this means that the one I am bringing in is not proper xml/formatting, something like that
j
Oh yeah, they are REALLY finicky
I'm using SuiteScript to generate XML from a Rich Text field and it's....time consuming
all XML tags have to be closed, htmlentities have to be correctly handled, etc
good times
l
Ya.... give me JSON any day
I may have to go another route on this, Amazon is creating the PDFs out of our control. Thanks for the help, I'll try some of the SS rendering methods.
j
sure thing. Good luck! Sounds like an interesting challenge.
l
btw it printed fine w/different pdf
j
ok so at least the general concept is right
it's a start