not clear what You wan't to do
- appending pdf's -> MBS Plugin (among others)
- importing into FileMaker -> get data as xls, csv, text - then import and process (creating desired content using script/functions)
Thank you, David. I will try your suggestion
Thank you for taking the time to write. I am not importing. What I want is to create a PDF using a script (that's done) and to append a file (pdf) from the PC into the just created PDF
Markus, Your suggestion worked just fine!. Thank you very much
David, I am sorry I mentioned the name Markus when I meant to address you. I couldn't rectify myself earlier because the site wasn't allowing me to login.
I do have a question: after I tried your suggestion the PDF I am appending comes out on the first page. And to work I have to save both PDFs, the one I created with the script and the one I want to append, in the same folder. Part of the script goes:
the first two lines create a PDF (original) from a record and saves it in a folder called "Cartas"; the last two lines get an existing PDF from a folder and appends it to the original PDF but, I have to save it to "Cartas" folder as well, and it is saved under the existing PDF file name, not the original PDF name as I wish it would.
Can you tell where am I failing?
if you have FMP Advanced, try looking at your file paths in the Data Viewer. If you don't, place a temporary Show Custom Dialog into your script showing your $filename2 so you can verify it.
Thank you for your time. I have FMP Advanced. The path to the file is correct but when I indicate it to Save Record as PDF, I have to save it as $FileName2, it won't allow me to save it as $FileName, so actually I am appending $FileName to $FileName2 and it should be the other way around. Regards.
You don't need to use the $FileName, $FileName2 routine. Simply set the first page of the PDF doc to Save As PDF (no append) to $FileName. Make each subsequent page to $FileName with Append checked. This will append to everything named $FileName.
I don't know if you are using the word append correctly. To append a written file, signifies adding more relevant content but that the content is separate. But in languages like Perl - here is an example of what you could write.
"In this episode of the Perl tutorial we are going to see how to append to files using Perl.
In the previous episode we learned how to write to files.
That's good when we are creating a file from scratch,
but there are cases when you would rather keep the original file, and only add lines to the end.
The most prominent case is when you are writing a log file.This article shows how to do this using core perl function. T
here is a more modern and more readable way using Path::Tiny.
- open(my $fh, '>', 'report.txt') or die ...
Opening a file for writing using the > sign will delete the content of the file if it had any.If we would like to append to the end of the file we use two greater-than signs >> as in this example:
- open(my $fh, '>>', 'report.txt') or die ...
style="margin-bottom:10px;color:rgb(51, 51, 51);font-family:Roboto, sans-serif;font-size:16px"
- use warnings;
- use 5.010;
- my $filename = 'report.txt';
- open(my $fh, '>>', $filename) or die "Could not open file '$filename' $!";
- say $fh "My first report generated by perl";
If you run this script several times, you will see that the file is growing.
Every run of the script will add another row to the file.
If you are writing a script to automatically import specific digital content into an FMP database, empty, with fields, with fields and data, you should test each scenario. My recommendation is to become entirely knowledgeable about each file format.
I use tools to extract the data from a PDF, and place that data in a Spreadsheet, normalize the data, and then match the fields in the FMP to the spreadsheet.
Thank you, Dwelam for taking time to explain. I ran the example with the script debugger but when the Insert PDF ("$file") step comes up, no insertion occurs. See the screen shot after the Insert step:
there's an error:
But I think I am catching the idea, although the file I want to append is an PDF that already exists in a folder (ie, a contract, a due date remainder, etc).
Again, thank you for your time, I really appreciate getting advise from knowledgeable people
Interesting point, gdata. I am just learning that one or more '>' will delete content. By "appending" I mean to use a script to create a PDF from record(s) in the database. Once it is created I want to append other PDF's that I consider necessary to it but were not created with FileMaker, they are just forms, letters, etc, all in PDF format.By David Moyer's indication I almost was able to get what I wanted; the only thing is that the external PDF is the one getting appended by the PDF created with the script and not the other way around. I want the external PDF to remain the same (since it is a form or a reminder,etc).
Thank you for your time.
The script uses your temporary path to create the document. You could try changing line 17 in the script. Change "Get ( TemporaryPath )" to "Get ( DocumentsPath )", and see if that helps. You'll just have to delete the file in your Documents folder manually.