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.

Fri Feb 15, 2019 7:44 am

Hi,

How do we convert each page of pdf into diff html file.

10 page of pdf to 10 html file.

best regards,
Vernon

vernon1111
 
Posts: 44
Joined: Fri Mar 02, 2018 4:34 am

Fri Feb 15, 2019 8:58 am

Dear Vernon,

Thank you for contacting us.
Sorry there is no direct method to achieve your requirement, but you could draw each page to a new document and then save it to a html file. Please refer to the following code. If there is any question, please feel free to write back.
Code: Select all
PdfDocument doc = new PdfDocument();
doc.LoadFromFile("Multipage.pdf");
for (int i = 0; i < doc.Pages.Count; i++)
{
    PdfPageBase page = doc.Pages[i];
    PdfDocument newDoc = new PdfDocument();
    SizeF size = page.Size;
    PdfTemplate template = page.CreateTemplate();
    PdfPageBase newPage;
    newPage = newDoc.Pages.Add(size, new PdfMargins(0));
    newPage.Canvas.DrawTemplate(template, new PointF(0, 0));
    newDoc.SaveToFile(String.Format("output_{0}.html", i), FileFormat.HTML);
}

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Tue Feb 19, 2019 9:18 am

Hi,

Greetings from E-iceblue!
Did my code work for you?
Thanks in advance for your valuable feedback and time.

Sincerely,
Nina
E-iceblue support team
User avatar

Nina.Tang
 
Posts: 1385
Joined: Tue Sep 27, 2016 1:06 am

Fri Mar 01, 2019 10:41 am

Hi Nina,

Thanks for the answer,

I will let you know if I have any more questions.

Thanks

vernon1111
 
Posts: 44
Joined: Fri Mar 02, 2018 4:34 am

Mon Mar 04, 2019 1:27 am

Hello,

Thanks for your feedback. Just feel free to contact us if you need other helps. Have a nice day!

Sincerely,
Lisa
E-iceblue support team
User avatar

Lisa.Li
 
Posts: 1536
Joined: Wed Apr 25, 2018 3:20 am

Return to Spire.PDF

cron