Jump to content

Using outputFileName per page per record


Recommended Posts

I have a template with 6 different flyers all using the same information. I need to be able to output each page as a separate file and name it based off of a field name. I have found out how to use FusionPro.Composition.outputFileName to name each record but how do I do this for each page of each record.

 

For Example:

The csv contains 4 fields (dealer, address, date, and time) and 50 records.

There are six different flyers(6 pages in template) using all 4 fields.

I want to output each of the six flyers as separate pdfs and have the pdf named by the dealer field(flyer1_dealer.pdf, flyer2_dealer.pdf, flyer3_dealer.pdf, etc).

I have to send the different flyers to different people.

 

I have this that names all 6 flyers but do I need to make a for loop or something to save out each page as a separate file?

FusionPro.Composition.outputFileName = "flyer1_" + Field("Dealer") + ".pdf";

Link to comment
Share on other sites

I haven't tried this myself, but it sounds like you should be able to accomplish what you're trying to do without having to split each page into its own template:

 

I think you would want to name the pages in your template 1-6, set them all to unused, and then repeat each record 6 times. Then turn on each page based on the RepeatRecordCount. And then change your OnNewOutput rule to incorporate the count into the file name.

Link to comment
Share on other sites

Thanks Step!

I did get this to work using the same idea you gave me on my local computer. It works awesome.

My next thing is if I can do this on Marcom and set my output folder to our ftp. I have other products that pull from our ftp(see sample below)

and I used the same path in the outputFileName and it errors out. Does anyone know if I can use the outputFileName on Marcom and make the output path set to my ftp site?

Right now my customer places an order on Marcom and I pull down the data and the run/compose on my desktop and then copy all the files to our ftp for our customer to pull. We get an order every 2-3 days for upto 15 dealers per order and there are 4 pages/files per dealer. There's a lag from when the customer orders and the job gets into the works for me to do on my desktop. Our customer wants to be able order and download after hours.

 

pulls from ftp and uses returns page 1 of pdf

var frtname = "http://user:password@ftp.com/client/" + ToLower(Field("Dname")) + ".pdf";

var frt = CreateResource(frtname , "graphic" , true);

frt.pagenumber = 1;

return frt;

 

This is some of the code I used for OpenNewOutputFile on my desktop

it did a repeat record and turned a page on, created a named file for each page in the document.

var dealer = ToLower(Field("Dname"));

 

FusionPro.Composition.repeatRecordCount = 4;

for (var i = 1; i < 5; i++)

{

if (FusionPro.Composition.repeatRecordNumber == 1)

{

FusionPro.Composition.SetBodyPageUsage("Flyer1", true);

FusionPro.Composition.OpenNewOutputFile("Flyer1_" + dealer + ".pdf");

}

if (FusionPro.Composition.repeatRecordNumber == 2)

{

FusionPro.Composition.SetBodyPageUsage("Flyer2", true);

FusionPro.Composition.OpenNewOutputFile("Flyer2" + dealer + ".pdf");

}

if (FusionPro.Composition.repeatRecordNumber == 3)

{

FusionPro.Composition.SetBodyPageUsage("Poster1", true);

FusionPro.Composition.OpenNewOutputFile("Poster1" + dealer + ".pdf");

}

if (FusionPro.Composition.repeatRecordNumber == 4)

{

FusionPro.Composition.SetBodyPageUsage("Poster2", true);

FusionPro.Composition.OpenNewOutputFile("Poster2" + dealer + ".pdf");

}

}

Link to comment
Share on other sites

My next thing is if I can do this on Marcom and set my output folder to our ftp. I have other products that pull from our ftp(see sample below)

and I used the same path in the outputFileName and it errors out. Does anyone know if I can use the outputFileName on Marcom and make the output path set to my ftp site?

Well, technically you're not pulling files via FTP, you're pulling them via HTTP. But while you can access resources this way, there's no facility in either FusionPro or MarcomCentral to write an output file to a location outside of the LAN, via any protocol.

 

At any rate, I would ask your MarcomCentral-specific questions in the MarcomCentral forum. And you may want to contact your BRM/CPM with specific enhancement requests.

Link to comment
Share on other sites

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...