Inserting text across multiple pages with different templates- margins or headers

Hi,

I am evaluating Aspose PDF for one of my clients, and we are trying to achieve the following:

Create a PDF version of an HTMLcontaining an unknown number pages. The first page has a template with a large header and branding etc. Following pages (which contain the overflow text if the HTML exceeds the capacity of one page) have a smaller header and footer.

We are using an XML template to control the layout, and ASP.NET (C#) to insert the text. When I use one Section in my XML, I get a multi page document and the text flows perfectly. I have made the header show on first page only, but then on subsequent pages I have no headers at all.

So I am looking for a way to define two page templates (or Sections), and have the text flow from one Section into the following Sections without having to chop it up using my .NET code. Can this be done?

Thanks in advance

Hello Chris,

Thanks for considering Aspose.

If you need to convert an HTML file into PDF format, please visit the following link for related information HTML to PDF using InLineHTML

Whereas concerning to your requirement on creating a two page template, you can simply define a section inside an XML document, and if the contents of the PDF does not fit on one page, they will automatically flow to subsequent pages. If you set the value of IsFirstPageOnly property of HeaderFooter class to True, the Header/Footer will only be displayed on first page. By default it displays on all the pages belonging to particular section. For more related information, please visit the following links

In case I have not properly understood your requirement or you have any further query, please feel free to contact.

Hi Nayyer,

Perhaps I awas not clear in my first post. I have successfully used the IsFirstPageOnly and IsSubsequentPagesOnly to control the headers and footers. My challenge is that the margins on subsequent pages are smaller at the top, as the header is much smaller. Is there a way to achieve this.

Perhaps this is an enhancment request: It would be really cool if you could make a number of Sections in the XML template, and the text would flow through segments with the same ID in each section. This could also be used for multiple columns etc.

Although any thoughts on how I can get this content flow across pages with different margins would be much approciated.

Thanks again

Chris

Hello Chris,

Thanks for the additional information.

Aspose.Pdf provides the capability to control the margin and size of the Pages in a particular section. Please visit the following link for more information on how to Set Page Size and Margins

You can add number of sections in a PDF document. By default every section starts over the new page but you can control this behavior using IsNewPage property of Section class. The paragraphs in particular section remain in the same section. However, you can specify a particular ID to a specific paragraph. If the paragraphs cannot be placed in one page, they will be moved to next page within the same section. Please visit the following link for more information on how to Assign ID to Paragraph.

Please don't forget to check the following link for a better understanding of Aspose.Pdf for .NET Document Object Model (DOM)

In case I have still not understood your requirement, please share your existing code/sample resource files, so that we can test the scenario at our end.

Thanks again for your reply Nayyer,

I have attached two files. An XML document I am using as my template (actually it works just as a sample file also, but in practice will replace the large text areas with content from other sources using C#), and the output of the sample XML as a PDF. The result is exactly what we are trying to achieve.

The only problem is that we don't know where to break the text on the first page so that it will fit, so we don't really want to have to do this manually (or by using code). Is there any way to achieve this result without cutting the text up into 2 blocks (i.e. one for first page, and one for subsequent pages)

Thanks again

Chris Summers

Hello Chris,

Thanks for sharing the resource files.

I have tried creating the PDF document using the XML file that you have shared and the output is same as the PDF document that you have shared. But frankly speaking, I am still unable to understand your requirement when you have said "Is there any way to achieve this result without cutting the text up into 2 blocks (i.e. one for first page, and one for subsequent pages)" Do you mean you need to break the paragraph at line Donec vel ipsum sapien. Maecenas tortor velit, blandit eu pellentesque in, aliquam and don't need to display the rest of the paragraph over subsequent pages ?

We apologize for the delay and inconvenience.

Hi Nayyer,

The point is we don't know where the break would occur because the text will contain HTML (including tables and images etc) which makes it impossible to guess where the break is needed. As such we want to take advantage of content flowing onto subsequent pages automatically (which works perfectly if only one Section is used). Can this be achieved, or do I have to make a sepereate Section with seperate margins etc as I have in the sample XML?

Is it possible to discuss this with someone on the phone or in a chat session?

Thanks

Chris

Hello Chris,

I am afraid I am still unable to grasp the complete requirement. You can also discuss this matter over Live Chat session with me. Please use the link presented over the Right-Top of this page to get connected to me. You can catch me around 6:00AM GMT to 2:00 PM GMT and later at 5:00 PM GMT to 7:00PM GMT.

In case you have any further query, please feel free to contact. We apologize for your inconvenience.

HI,

I have not seen you online since you sent this. I am sorry that this is so confusing, I have read, and re-read the post many times, and asked others to do the same, and it is clear to them. I will try one more time.

  • I have a large block of HTML text, lets call it TEXTA. It contains TAbles, images and formated text.
  • I want to make a PDF doc from TEXTA.
  • If TEXTA does not fit on the first page of the PDF (Lets call this PDFFRONTPAGE), then it should flow onto subsequent pages, lets call these PDFOVERFLOWPAGES.
  • The look and feel for PDFFRONTPAGE and PDFOVERFLOWPAGES is different, as they have different margins, headers and styles as I showed in the example PDF I uploaded previously.

Is there anyway to achieve this without chopping up TEXTA into two pieces (i.e. One piece for PDFFRONTPAGE and the rest for PDFOVERFLOWPAGES). This works perfectly if PDFFRONTPAGE and PDFOVERFLOWPAGES have the same design, but not when they are different.

Thanks

Chris Summers

Hello Chris,

Thanks for sharing the detailed information.

We are looking into the details of this problem and will get back to you soon. We apologize for the delay and inconvenience.

Hello Chris,

I have gone through your requirement in details and as per my current understanding, your requirement is currently not supported by our product. But I have logged it under New Features list in our issue Tracking system as PDFNET-18680. Our development team will further look into the details of this requirement and see if we can support this feature or not. Once we have some definite news, we would be pleased to update you with the status of implementation.

Your patience and comprehension is greatly appreciated in this regard. We apologize for your inconvenience.

The issues you have found earlier (filed as 18680) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

Thank you for adding this to the API, I am re-evaluating Aspose PDF for our project. I think I understand how this works using the .NET API, but I don’t see it in the XML Schema for section elements.


Is it possible to create this first page info using the XML based document structure?

Thanks in advance

Chris


Hello Chris,

Sorry for replying you late.

I am afraid in current release version, you cannot access FirstPageInfo property of Section class through XML. However, our development team is working over this requirement and soon you will be updated with the status of correction. Please be patient and spare us little time.

We apologize for your inconvenience.

The issues you have found earlier (filed as 18680 ) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.