Merging PDF with Data batch - javascript

I'm a new french stackoverflow user, so sorry for my misspelling.
I would like to know how to automatically merge writable/alterable PDF with data file(XML, TXT or FDF).
I have seen that Adobe Acrobat Pro could import Data, but in the wizard action, I've not found "import" choice to make it automatic. The wizard offers JavaScript add but i don't find any PDF manipulation line code JS.
Does JavaScript is the solution for my issue ?
Or do you have some alternative ?
Thx for reading.

You can use the COM of Acrobat or PDFCreator to do it. There is a lot of example here (And in French):
http://www.developpez.net/forums/d431662/logiciels/microsoft-office/excel/contribuez/excel-word-pdf-adobe-acrobat-pro-pdfcreator/

With "Wizard", you are using the Actions Wizard?
If so, this is understandable. However, there is the Acrobat JavaScript function which would import an FDF (or a few other data formats); have a closer look at the importAnFDF() method in the Acrobat JavaScript documentation (which is part of the Acrobat SDK, downloadable from the Adobe website).
There are other approaches, by importing a tab-delimited file as File Attachment (aka Data Object), and then interpret this file to create your data table, and then use Acrobat JavaScript to fill out the form, save or print it, and so on.
A third method would be using Template pages in the PDF, craft your FDF so that it supports Templates, import it into the base document and then wait until it has spawned all the pages. You then have one big document containing all the filled forms.
Finally, if you have a higher volume, you will be better off using a server-side fill-in tool, such as FDFMerge by Appligent.

Related

How to embed interactive chart inside a pdf?

I have a requirement wherein we have to display a chart and few parameters (date, name etc) inside a pdf file.
The user should be able to modify the chart depending upon the data selected by the user.
I have seen some examples https://www.youtube.com/watch?v=Z5bdBeFwNCU but not sure how these are getting generated.
Any pointer is highly appreciated.
Also I am a java script developer so if there is any solution in JS It would be easier for me to follow
You can look into the docmentation of the creators (Adobe):
Using JavaScript with PDF files - Tutorials about process.
Javascript API reference for PDF format - a PDF document listing all commands.
I did a few projects where charts/diagrams are created on the fly, based on user entries. For that, I used a combination of form fields and annotations, whose parameters are calculated using Acrobat JavaScript.
There is also an undocumented function in Acrobat JavaScript which allows to create the icon for button form fields.
As the actual approach depends a lot on the kind of information and graphs, one would have to look at what has to be accomplished. Feel free to contact me in private, if there is some interest. It might be worthwhile to look at "make or buy"…

Javascript to prompt for pdf files to insert?

I am attempting to have a button on a form that will launch file explorer for the user to select pdf files to insert into form.
The insertPages script will insert pages from a specific cPath, but I need the user to be able to select the pages to insert, as they will be different from case to case. Is there a way to accomplish this using javascript?
I am using Bluebeam, which is very similar to Acrobat. I have created several templates and javascript code using the Acrobat API Reference, and thus far the Bluebeam engine appears to operate nearly identically. In a perfect world, the button would launch the "Insert Pages" menu in Bluebeam.
Thanks in advance for the help!!
If this were Acrobat, I'd use app.browseForDoc(). The returned object has three properties...
cFS - A string containing the resulting file system name for the chosen file.
cPath - A string containing the resulting path for the chosen file.
cURL - A string containing the resulting URL for the chosen file.
Get the full path to the file from there then use insertPages.
In Acrobat, it can only be run in a Privileged context. I'm not sure if it will work the same way in BlueBeam though they have done a fairly good job of duplicating the form field related JavaScripts.

Generate a pdf from a pdf "template" in Meteor

I'm looking to generate a pdf from an existing pdf "template". For example, the pdf "template" would have the, text, fields, and layout -- all that would be left to do is fill in "fields" with data.
I would like to populate these fields with the appropriate data from a mongo collection, and generate a new pdf from it.
I am looking at the pascoual/meteor-pdfkit package, but I only read about how to generate a pdf from scratch. Also, I reviewed http://pdfkit.org/ but found no examples of my approach.
Is the above possible with an existing meteor pdf package? What's the best way to go about this?
For example, the following is part of a pdf document, the "fields" need to be populated with data I get from a collection:
UPDATE: I'm looking into using pdftk server: https://www.pdflabs.com/tools/pdftk-server/ (the command line) to do form fill pdf (fdf). This seems to do what I want, and runs on all platforms.
Ended up using FDFs (actually XFDFs) to do the PDF form fills. PDFtk server was the tool I ended up using.

Read and Write DOCX file

I have 2 docx files that I am working with. One docx file contains text information of a product (start serial number, length, width, and height). The other docx file contains a sticker label with an image and all of the text information from the first file.
This is what I do currently:
I open the first docx file and copy all of the text information (serial, length, width, and height)
Then I paste each info into the second docx file that contains the formatted label.
If I need to make more than one label, I copy the label and increment the serial number by 1.
This takes a lot of time to make several labels for different products. My goal is to come up with an easier way to take data from one docx and inject it into the other. Also, generating more labels when needed.
My first thought was to extract the docx file to get it's xml contents. Then read the data using javascript, c++, or any other language. Then Ask user to input number of labels to generate, manipulate the xml, and repack it as a docx file.
Then I thought about trying to use the windows office "mail merge" feature, but I have never done this before.
I would like to know if anyone has any suggestions for an easy solution to import data from one docx file and generating labels into another.
I am open for any suggestion.
Also, I am not a professional programmer. I am an undergraduate computer engineering student with some experience in c, c++, java, javascript, python, MIPS assembly, and php.
The only open-source (and probably easier to come by) solution I know know is:
http://poi.apache.org/
http://poi.apache.org/document/quick-guide-xwpf.html
This is a good bet when it comes to speed and it is free software.
But if you open a file, alter it and save it again - the result can be flaky: The formatting can be slightly off. At least in my tests with the pptx counterpart.
I reckon when you have user interaction (web page?) in order to create the document, you can build a small HTTP Api around the library.
There is also: http://www.docx4java.org/trac/docx4j - which I have not tested yet.
You can also go the C#/Redmond way: How do I create the .docx document with Microsoft.Office.Interop.Word?
The Interop (2nd Example in the first answer of the question above) way gives the best result when it comes to the accuracy of the formatting. Basically when you open a file with Interop - it will look the same when you alter and save it. But you cannot use this when interacting with a user - because it starts a separate MS Office process - and I would not count on this from my own user experience. But if you want to generate these files as a batch in a single user session - it will deliver a good result.
I cannot comment on the "OpenXML SDK" library described in the above SO question.
Wath about the Open XML https://www.youtube.com/watch?v=rMnEl6JZ7I8 and website developer http://openxmldeveloper.org/ .
On the site you found sdk for:
Open XML SDK for JavaScript: http://openxmldeveloper.org/wiki/w/wiki/open-xml-sdk-for-javascript.aspx. Demo: http://openxmldeveloper.org/blog/b/openxmldeveloper/p/openxmlsdkjs_demo.aspx
Open XML and Java http://openxmldeveloper.org/blog/b/openxmldeveloper/archive/2006/11/21/openxmlandjava.aspx
.Net Resources http://openxmldeveloper.org/resources/dotnet/m/cc/default.aspx

Retrieving a csv file from web page

I would like to save a csv file from a web page. However, the link on the page
does not lead directly to the file, but it calls some kind of javascript, which leads
to the opening of the file. In other words, there is no explicit url address for the
file i want to download or at least I don't know what it should be.
I found a way to download a file by activating Internet Explorer,going to the web page
and pressing the link button and then saving the file through the dialog box.
This is pretty ugly, and I am wondering if there is a more elegant (and fast) method to retrieve a file without using internet explorer(e.g. by using urllib.retrieve method)
The javascript is of the following form (see the comment, it does not let publish the source code...):
"CSV"
Any ideas?
Sasha
You can look at what the javascript function is doing, and it should tell you exactly where it's downloading from.
I had exactly this sort of problem a year or two back; I ended up installing the rhino javascript engine; grepping the javascript out of the target document and evaluating the url within rhino, and then fetching the result.

Categories