Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Tue Jun 27, 2017 12:32 pm

I have an HTML string that needs to fit on multiple pages. The below code is what I am using. I have tried every combination for the format.Layout and format.Break options with no luck. The string gets added to the page but just truncates off the bottom and doesn't paginate to the next page. What am I doing wrong or what code am I missing?




Code: Select all
PdfDocument Doc= new PdfDocument();
        PdfNewPage page = Doc.Pages.Add(PdfPageSize.Note) as PdfNewPage;


        PdfFont font = new PdfFont(PdfFontFamily.Helvetica,2,PdfFontStyle.Regular);
        PdfBrush brush = PdfBrushes.Black;

        PdfHTMLTextElement kbContent = new PdfHTMLTextElement(lblHTMLcontent.Text, font, brush);

        kbContent.TextAlign = Spire.Pdf.Graphics.TextAlign.Left;

        PdfMetafileLayoutFormat format = new PdfMetafileLayoutFormat();
        format.Layout = PdfLayoutType.Paginate;
        format.Break = PdfLayoutBreakType.FitPage;
 
        kbContent.Draw(page, new RectangleF(0, 0, page.GetClientSize().Width, page.GetClientSize().Height), format);

       

rambach
 
Posts: 6
Joined: Thu Nov 17, 2016 5:55 pm

Wed Jun 28, 2017 2:48 am

Dear rambach,

Thanks for your inquiry.
I have tested the scenario you mentioned with Spire.PDF Pack(Hot Fix) Version:3.9.181, and the string could be placed on next page if the one page doesn't fit it. Please use the latest version and have a try. If the issue still exists, please provide us with the HTML for testing.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Jun 29, 2017 9:42 am

Dear rambach,

How is the issue now ?
Could you please give us some feedback at your convenience ?

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Fri Jun 30, 2017 8:45 pm

It still just never creates the additional pages and truncates the string. How does it know where to break the HTML string?

rambach
 
Posts: 6
Joined: Thu Nov 17, 2016 5:55 pm

Mon Jul 03, 2017 2:03 am

Dear rambach,

Sorry for late reply as weekend.
Please provide us with the HTML you were using here or send it to us(support@e-iceblue.com) via email. Then we will look into it and keep you updated.

Thanks,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Thu Jul 06, 2017 2:06 am

Dear rambach,

Thanks for your HTML on email.
I have noticed the issue and posted it to our Dev team. We will let you know once there is any progress.
Sorry for inconvenience caused.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Tue Jul 18, 2017 2:36 am

Dear rambach,

Thanks for waiting.
Due to the complexity of the issue, we need more time to investigate it. Considering this situation, there are other workarounds which might help you solve your issue quickly.
1) use LoadFromHTML method in Spire.PDF.
https://www.e-iceblue.com/Tutorials/Spi ... rself.html
2) use New Plugin and Spire.PDF.
https://www.e-iceblue.com/Tutorials/Spi ... lugin.html
3) use Paragraph.AppendHTML method in Spire.Doc, as Spire.Doc also supports converting html string to PDF.
Hope this helps. And once there is any progress about the issue you submitted, we will let you know.

Sincerely,
Betsy
E-iceblue support team
User avatar

Betsy.jiang
 
Posts: 3099
Joined: Tue Sep 06, 2016 8:30 am

Return to Spire.PDF