Jump to content

Multi-Page pdf's


dave2297

Recommended Posts

Hi all

 

Firstly let me say that I am not a programmer and that I use Fusion Pro in what is probably it's most basic for, ie adding names and addresses and images to pdf's.

 

It struck me, however, that Fusion Pro could probably help me in what is a very laborious, time consuming activity that has to be carried out with monotonous regularity.

 

I have a client who created planograms in a multi page pdf format of each section of the stores they own (this runs to several thousand pdf's), I am then asked to produce printed versions for each store - and all stores do not have the same layout, so my question is (and I think I've already guessed the answer) ...

 

say PDF1 has 5 pages, pdf2 has 9 pages and pdf3 has 14 pages - and I have a requests to print:

 

pdf1 and pdf3 for store1,

pdf2 and pdf3 for store2

pdf3 and pdf2 for store3

 

and i have a 3 csv's (labelled Store1,Store2 and Store3) with correctly filled columns and I HAVE to maintain that order.

 

At present my printer operator has to work down the spreadsheet printing in the required order, however, is it possible to output 1 (one) pdf per store keeping the sections in the required order?

 

I have managed, in Fusion (using a Create Multiple Resource rule), to produce the 1st page of the each pdf in a single pdf but can find no way to compose a single pdf with all of the pages from each individual pdf. (Does this even make sense?)

 

I hope that there is a genius out there who has stumbled across this problem before and may wish to share his eureka moment!

Link to comment
Share on other sites

Hi Eric/All

 

I've looked at the example and am sure that I can (with the help of the excellent comments) adapt it to fit.

 

My document needs to be A4 (no problem), the text box on P1 needs to be full size A4, again no problem - but, no matter what I try I can't set the overflow to Page 2 of my new document - is this necessary and if so how is it achieved?

 

My resultant logfile shows

 

Composing record #1, input record 1

The amount of text inserted into a flow exceeds the depth

of all frames in the flow <>. Text is truncated.

Text does not fit in the last frame on page 1 at (0.00, 0.00)

Composing record #2, input record 2

The amount of text inserted into a flow exceeds the depth

of all frames in the flow <>. Text is truncated.

Text does not fit in the last frame on page 1 at (0.00, 0.00).

etc....

 

resulting in a multipage blank file.

 

Any suggestions would be most welcome, thank you

Link to comment
Share on other sites

Are you adding a 2nd page with it's own text frame, setting it as an overflow page in the "Page Usage..." dialog and telling page 1 to use page 2 as an overflow page via the overflow button in the "Text Frame" dialog for the text frame on page 1?
Link to comment
Share on other sites

Hi eric

 

Thank you so much for your very prompt reply. In answer to your questions, NO, I had not set a 2nd page up in the page usage (but I had set up a 2nd page with the relevant text box). I have now done this and, surprisingly I am now getting a 234page blank pdf (twice the number of pages than there are files in my directory) - so something must be working :)

 

I now get the error message:

 

The amount of text inserted into a flow exceeds the depth

of all frames in the flow <>. Text is truncated.

Text does not fit in the last frame on page 1 at (0.00, 0.00).

Composing record #2, input record 2

The amount of text inserted into a flow exceeds the depth

of all frames in the flow <>. Text is truncated.

Text does not fit in the last frame on page 1 at (0.00, 0.00).

 

etc

 

However when 'compose is running I get repeating message

 

The specified Keep conditions could not be honored in the flow <>. Text is truncated

 

I just get the feeling that I'm so tantalisingly close to producing exactly what is required - only to be hampered by my own stupidity :(

 

Have you any ideas please?

Link to comment
Share on other sites

My initial guess would be that the text frame on either page 1 or page 2 of your template is not tall enough. If you look at the sample that I linked to in my original response, the frames actually exceed the trim edges of the pages. I believe this is because technically there are non-printing characters between your inline graphic images that need to "print" off the page, leaving room for the actual graphics within your trim area.

 

If this doesn't solve the problem, you may need to upload a sample of the files you are dealing with along with your current template so someone here can review. :)

Link to comment
Share on other sites

Hi Eric

 

I'm sorry I haven't replied earlier.

 

I increased the text box and that worked perfectly, thank you so much. :)

 

Can you tell me if it's possible to 'add' a sheet at the front of each of the imported multi-page pdf's that would just show the pdf name (this would have to be duplex)?

 

It's not a show stopper if it isn't possible but it would be a great benefit to our bindery when the output pdf is de-collated.

 

Thanks again

Link to comment
Share on other sites

Hello dave2297;

 

Adding a "PDF page header" to your output stream and making it duplex would be a fairly simple addition to your for loop. Add a conditional statement that would concatenate your pdf name in the poutput stream to be used as a page header and then a blank pdf page (from a separate pdf file) to your output stream when "pageloop" is equal to one THEN add any of the pages of your input pdf file. When pageloop is greater than one it would just concatenate the next page(s) of your input pdf file.

 

Something like this...

 

for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++)

{

if (pageloop == 1)

{

markupToReturn += PDFresourceRef.name + '<P>';

markupToReturn += '<graphic file="blank.pdf" position="afterline"/><P>';

markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" position="afterline"/>';

markupToReturn += '<P>';

}

else

{

markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" position="afterline"/>';

markupToReturn += '<P>';

}

}

 

 

Won't have a chance to test this but in thoery it should work. You may also try the Field("pdfName") value (or whatever it is called in your input data file) instead of "PDFresourceRef.name".

 

Whichever works, hope this helps.

.

Link to comment
Share on other sites

Hi David

 

Thanks for your interest and support.

 

I used your code and, after a little tweaking, it did indeed insert a duplex page between each of the pdf files that was returned - however, try as I might, I can't seem to get the 'pdf name' to print on this page.

 

I'm not a prgrammer (by any stretch of the imagination - and as previously stated!) but, if you can point me to the part of the code that you supplied that should print the file name on the header, I'm happy to have a fiddle!

 

Thanks

Link to comment
Share on other sites

Dave,

 

Where are you getting the names of the pdf files from? Are they set names in your template, or are they variable names that you are reading in from a data file? Somewhere you must be getting a "pdf1.pdf" or "pdf2.pdf" file (or some other name) to use as your "PDFresourceRef.name" in the markupToReturn statement for the graphic file. This is the name that you need to append (concatenate) on to the markupToReturn.

 

As I stated in my previous post you might need to use your field name Field("pdfFileName") entry that you are reading in to accomplish this.

.

Link to comment
Share on other sites

Hi David

 

Thanks for your prompt reply. It seems as though the gremlins have been at me during the night! (explained later)

 

Where are you getting the names of the pdf files from? Are they set names in your template, or are they variable names that you are reading in from a data file? Somewhere you must be getting a "pdf1.pdf" or "pdf2.pdf" file (or some other name) to use as your "PDFresourceRef.name" in the markupToReturn statement for the graphic file. This is the name that you need to append (concatenate) on to the markupToReturn.

 

I have a single column csv headed PDF calling for the pdf names in the order that they are required (attached). The 'concatenation' is the bit that I'm having the problem with (presumably this will print a header on the BLANK.pdf file)? Which markupToReturn statement do I fiddle with - I confess I've tried them all with a resounding lack of success.

 

I have shown the code that I've botched together from all of the previous posts and links and, whereas yesterday I had a perfectly working script (apart from printing the name on the inserted blank sheet) the gremlins have attacked and I now only get a single sided divider - which means that I have to go through the output file and insert pages :(

 

The 'compose' message that I'm getting is 'Graphic BLANK.pdf is not found or is not processed properly - even though it resides in the same directory as the other pdfs I'm calling for!!!!:mad::mad:

 

CODE I'M USING

 

//This rule will examine the input data to find a list of PDF files

//that are to be inserted in the template.

 

//Each PDF is of varying and unknown page count. Therefore, this script

//will determine that page count and reference each page in each PDF.

 

//The resulting tagged markup will include the variable <graphic> tag to reference

//the PDF pages and include as inline images in the template.

 

//This text rule in inserted into a large text frame on a Body page. That frame

//is set to Overflow to a frame on an overflow page.

 

 

//First, declare the variables and initiate them with values.

 

FieldName = '';

PDFfileName = '';

pagesInPDF = 0;

markupToReturn = '';

pathToAllPDFs = '/Volumes/Current Work/WILKINSON/BINDERS/LAYOUTS/';

pathToPDF = '';

PDFresourceRef = '';

//return pathToAllPDFs;

 

 

//There are 3 fields in this sample - Doc1, Doc2, and Doc3. We will loop through

//each field name with a simple for loop. The following variable sets the counter

//for that loop.

//For example, if you have 25 fields instead of 3 with the PDF file names in them,

//such as "Doc1" through "Doc25" you would set the following to 25.

 

FieldsToInspect = 1;

 

 

 

//This is the main loop that parses through all of the fields for a given record.

 

for (fieldCounter = 1; fieldCounter <= FieldsToInspect; fieldCounter++)

{

FieldName = 'PDF' + fieldCounter;

PDFfileName = Field("PDF");

pathToPDF = pathToAllPDFs + PDFfileName;

 

//Create a new resource that references this

PDFresourceRef = CreateResource(pathToPDF ,'graphic' ,'no');

 

//Find out how many pages it has

pagesInPDF = PDFresourceRef.countPages;

 

//return PDFresourceRef.name;

 

//This is the secondary loop for this script.

//It will loop through and create markup for each page in the PDF.

 

for (pageLoop = 1; pageLoop <= pagesInPDF; pageLoop++)

{

if (pageLoop == 1)

{

markupToReturn += PDFresourceRef.name + '<P>';

markupToReturn += '<graphic file="BLANK.pdf" position="afterline"/><P>';

markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" position="afterline"/>';

markupToReturn += '<P>';

}

else

{

markupToReturn += '<graphic file="' + PDFresourceRef.name + '" pagenumber = "' + pageLoop + '" position="afterline"/>';

markupToReturn += '<P>';

}

}

 

 

 

 

 

 

//remove the last <P>

markupToReturn = Left(markupToReturn, markupToReturn.length - 3);

 

 

return markupToReturn;

}

 

Hopefully you can direct me to the, no doubt obvious to you, glaring mistake that I'm making?

 

Thank you so much

Hillsborough.csv.zip

Link to comment
Share on other sites

Hi Dan

 

Once again thanks for the wonderfully quick response. How I envy your expertise!

 

Your change in the code solved the problem of putting the 2page (duplex) BLANK.pdf between each 'resource', thanks.

 

I'm still desperately trying to figure out how (and where) to 'concatenate' the pdf.name from my data stream to appear on this divider sheet. I feel that it will either be a "Eureka' moment - or, more likely, one of you experts will take pity on me :)

 

Thanks - my drinks bill is going to be pretty hefty if any of you venture on to these shores!

Link to comment
Share on other sites

  • 2 weeks later...
Dave,

 

Where are you getting the names of the pdf files from? Are they set names in your template, or are they variable names that you are reading in from a data file? Somewhere you must be getting a "pdf1.pdf" or "pdf2.pdf" file (or some other name) to use as your "PDFresourceRef.name" in the markupToReturn statement for the graphic file. This is the name that you need to append (concatenate) on to the markupToReturn.

 

Hi David

 

Hope you are well and sorry about the delay in replying - pressure of work etc etc etc. I am getting the info from a data file - in fact this whole exercise revolves around a data file with just one column 'PDF'

 

Everything now works - except - I don't understand how I need to append (concatenate) the FieldName and on to which markupToReturn statement (there are 3 and I seem to have tried all of the options and still fail to print the pdf name on the insert sheet)

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...