Drupal print module: controlling layout in PDF files? - pdf

Using the print module and tcpdf I'm trying to fix the layout of the PDF files for a specific content type. I'm messing around in the tpl.php file and can't find a way to modify individual fields. There's just the massive $print['content'] variable that contains all of the page content. So, is there a way to access each field?
Basically I want full control over how fields (their labels, data, etc) are displayed. Currently, they are displayed like inline elements, one after the other. This looks pretty ugly.

When you edit a "View" you will notice a link that says "Theme: Information" it retrieves all suggested tpl's for the whole $output and also for each of the fields.

Related

Is there an possibility to save a dynamic pdf as static but still have interactive fields within the document?

I have a dynamic pdf which I want to use for DocuSign and thus needs to be static. I cannot simply make use of the print as pdf function as I still want to use the interactive fields within the pdf.
I Tried to use Adobe AEM Forms Designer to save the document as static. But solely the first page of the form is saved.
Regarding your concern, I would like to share the following information, you can learn about PDF form field transformation. It enables you to transform PDF form fields automatically into DocuSign tabs, carrying over all of their existing values. The locations of the created tabs will match the locations of the fields from which they were generated.
To transform PDF form fields into DocuSign tabs, you need to set the transformPdfFields property on the documents whose fields you want to transform.
https://developers.docusign.com/docs/esign-rest-api/esign101/concepts/tabs/pdf-transform/
https://www.docusign.com/blog/developers/the-trenches-pdf-form-field-transformation
Best Regards,
Eric | DocuSign

Can I make page-unique headers/footers in MS Word?

I'm writing VBA to process MS Word documents, and I need it to examine the contents of individual pages and generate related header/footer text from that. Is there a way to do this without creating new Sections?
I need the document to flow as it should, unbroken by Sections, but I also need (some of) the header/footer text to be distinct, per page. I know this is unusual due to auto-flowing pagination, etc. But, it really is necessary in this case; pieces of the header/footer must tie directly to each page's contents. That said, it may not be mandatory to have the text actually inside the "proper" header/footer; but, I do need the end result to be to that same effect.
Any tips? Can headers/footers be used for this? (In my research, it appears they may not be able to, although I may be missing something. Any other tips, if not? Perhaps some sort of special field/box?)
Note: Obviously, running this code would be a final step (once the document is in final form) since any editing of the document would re-flow its layout, modifying page contents.
If you don't want to use sections, you can use conditional IF fields like this:
{IF { PAGE } = 2 "Second Page" "Other Page" }
Note that you need to create nested fields for that, e.g. by pressing Ctrl+F9.

Is it possible to use variables in a PDF document?

I want to make a editable PDF document – but I want to take it a step further.
Is it possible to create some editable fields on the first page where the user can put in personal information (name, age etc.) and have the document fill itself in where "name" is required?
I need this for some employment contracts and it would be alot faster if the user only needs to fill the information in once, print the PDF and sign it. :)
In PDF a single form field may have multiple widgets. By definition all these widgets have the same content.
E.g. have a look at thie sample document aFieldTwice.pdf. You see two fields. As soon as you edit one of them and press enter, the same content occurs in the other one.
This might be what you look for.

How to create switchable multi-language pdf form?

I want to create a pdf form for two language (Chinese/English) UI, and there's a button(s) or somethings on the form for language switch, is there anyway can make it? and how to do?
thanks!
Thanks for all reply!
Actually I got a sample like this,
PDF Sample
there're two checkbox on the top-left of the form, one is for English UI, the other is Chinese, I just want to know how to make PDF like that sample? (and I don't see any layers on the sample...)
thx
mkl's comment (which he should turn into a full answer, really) already hinted at the option to use different page templates residing in the same file.
Another option you could explore is this:
put the two language versions into 2 different layers (or 'optional content groups' in PDF parlance)
make the visibility of the two layers toggeable
let the user activate that layer which he/she needs.
Layer activation can be handled through normal Acrobat Reader user interface elements.
The layer switching can be made accessible via a "button" on the PDF page too -- but that requires additional JavaScript to be embedded in the PDF (something many people are not particularly keen about).
As Kurt proposed, I make my comment on Frank's answer an answer in its own right:
Actually there is a pdf feature seldomly used nowerdays, page
templates. Thus, those two forms can reside in the same file in
different page templates, and based on some initially present buttons
("English version", ...) the desired form is spawned.
Unfortunately I don't know how to create page templates using some easy-to-use tool, I only came a cross them in the context of integrated PDF signatures (depending on the signature type, page template instantiation is a document change not breaking the signature) and tested them with low-level tools.
Essentially page templates are PDF objects just like page dictionaries of the normal pages, they are not XFA stuff. They merely are not referenced in the pages tree but instead in the name tree.
There is a JavaScript command which creates a visible page based on such a template --- I don't know which anymore; I may be able to find out when I'm back in office next week. This command would have to be bound to the inital language selection button in the file.
The problem will be in switching the static text - PDF does not allow this.
If I were you, I would split the document into two identical forms in the respective languages. You can use bookmarks and links on the first page to navigate to the right part of the document.
Note that it is possible to assign the same field names to the Enlgish/Chinese versions of your fields. This will make it easier to process the submitted form data because the process path would be independent of the chosen language. It will also simplify any JavaScript (validation, summing, etc.) you plan to add.

web based form to collect data and populate to a fillable PDF

Is there a script that anyone can suggest that would allow me to create a HTML or PHP web based form to collect data and save that data. the call the data to be populated in a fillable pdf?
If you have an existing PDF that you want to populate, and that PDF just has text fields (no checkboxes or radio buttons) then CAM::PDF may be able to help you. You can use it as a Perl library directly, or use its command-line interface. CAM::PDF is not useful for generating PDFs from scratch, however. Furthermore, if you have embedded fonts, then you need to ensure that all of the characters you plan to insert are represented in the embedded font.
Use a normal web page to get the data. If not sure how to do it, look for "php forms" on google, there are plenty of tutorials.
Then use a php pdf generator, like this one, to create the PDF file. If you look hard enough, you will probably find a pdf generator that will let you use a template with placeholders where the entered data should be.