Jump to content

Recommended Posts

Posted

Hello everyone!

I have jobs occasionally where the pdf comes in with the data merged and just needs to be imposed. Is there any way that I can impose a multipage pdf without a data source?

Posted

Here's a technique that Ste Pennell posted a while back

 

OnJobStart:

FusionPro.Composition.composeAllRecords = false;
FusionPro.Composition.endRecordNumber = 4; // Number of cards you have

 

OnRecordStart:

FusionPro.Composition.repeatRecordCount = 500; // Quantity of each card

var card = CreateResource("path/to/resource/YOURPDFNAME.pdf",'graphic',true);
card.countpages;
card.pagenumber = CurrentRecordNumber();

FindGraphicFrame("YOURGRAPHICFRAMENAME").SetGraphic(card);

 

Posted
1 hour ago, lasdoog said:

Here's a technique that Ste Pennell posted a while back

 

OnJobStart:

FusionPro.Composition.composeAllRecords = false;
FusionPro.Composition.endRecordNumber = 4; // Number of cards you have

 

OnRecordStart:

FusionPro.Composition.repeatRecordCount = 500; // Quantity of each card

var card = CreateResource("path/to/resource/YOURPDFNAME.pdf",'graphic',true);
card.countpages;
card.pagenumber = CurrentRecordNumber();

FindGraphicFrame("YOURGRAPHICFRAMENAME").SetGraphic(card);

 

Hi Lasdoog, thank you for the javascript. I'm a bit rusty with scripting/how to use it, etc. Is there an easy way to run this?

Posted

Here's something a little easier with instructions and a sample.

Make a new blank PDF that matches the page count of each record in your PDF. So lets say its a 2 page postcard.

Set your data file to be "None".

Make a graphic frame on each page and name it the page number, ie "1" on page 1 and "2" on page 2.

Add an Event rule for OnRecordStart with the following code:

//name each graphic frame just the page number
var pages_per_record = 2;
var path_and_PDF_name = "16pager.pdf";

//==================================================

var r = CreateResource(path_and_PDF_name,'graphic',true);
FusionPro.Composition.repeatRecordCount = r.countPages / pages_per_record;
for (i = 0; i < pages_per_record; i++) {
	r.pagenumber = i + (FusionPro.Composition.outputRecordNumber * pages_per_record) -1;
	FindGraphicFrame(i +1).SetGraphic(r);}

Edit the pages per record if its different than 2

Put in the name of the PDF. If it's in a different location than the template you will need to add the path. Use "\\" for each folder, ie "C:\\temp\\mypdf.pdf"

Compose as 1 record.

impose_existing_pdf_sample.zip

Posted

I realized that code came from an older piece that was setup for 2 page documents only and didn't check it close enough to realize it isn't as versatile as I thought. The code needs to change a little to work for records that are more than 2 pages. Attached is a revision that should work better.

Revised code in sample:

//name each graphic frame just the page number
var pages_per_record = 4;
var path_and_PDF_name = "16pager.pdf";

//==================================================

var r = CreateResource(path_and_PDF_name,'graphic',true);
FusionPro.Composition.repeatRecordCount = r.countPages / pages_per_record;
for (i = 1; i <= pages_per_record; i++) {
	r.pagenumber = i + (FusionPro.Composition.outputRecordNumber * pages_per_record) -pages_per_record;
	FindGraphicFrame(i).SetGraphic(r);}

 

impose_existing_pdf_sample.zip

Posted

Hi, yes, you can set the data file to "None" when you use the data definition wizard. If you have a recent version of FusionPro there is a rule called "Output Each Page as Its Own Record" which would then impose all the pages of the PDF as if they were separate records.

image.png.b2861cee5770e5abd41b4488363c4026.png

Note that if there are many pages this might not be super fast.

 

 

  • Like 2
Posted
On 3/8/2024 at 6:11 PM, Douglas Cogan said:

Hi, yes, you can set the data file to "None" when you use the data definition wizard. If you have a recent version of FusionPro there is a rule called "Output Each Page as Its Own Record" which would then impose all the pages of the PDF as if they were separate records.

image.png.b2861cee5770e5abd41b4488363c4026.png

Note that if there are many pages this might not be super fast.

 

 

Thank you Douglas! This is PERFECT! I really appreciate your help! 🙏

  • Like 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...