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 Mar 14, 2017 2:01 am

Hi,

I have an issue when converting a HTML source to PDF. The images contained in the source (as a Base-64 string) seems to be at a lower resolution than the original image. The text also seem to be blurry with a slight background colour/shadow. Please see attached image for the PDF that was converted using the SaveToStream method and emailed as an attachment.

SpirePdfTest.PNG


Regards,

Adhy

akarina94
 
Posts: 3
Joined: Tue Mar 14, 2017 1:53 am

Tue Mar 14, 2017 3:18 am

Dear Adhy,

Thanks for your inquiry.
Please provide us HTML so that we can provide you a solution quickly.

Thanks,
Betsy
E-iceblue support team
User avatar

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

Tue Mar 14, 2017 3:38 am

Hi Betsy,

Attached is the html.

akarina94
 
Posts: 3
Joined: Tue Mar 14, 2017 1:53 am

Tue Mar 14, 2017 7:23 am

Dear akarina94,

Thanks for your HTML.
We suggest you use Spire.Doc to convert that HTML to PDF, the result is better. Please download Spire.Doc Pack(hot fix) Version:5.8.70 and have a try. And here is sample code for your kind reference.
Code: Select all
            Document htmldoc = new Document();
            htmldoc.LoadFromFile("SpirePdfTest.html", FileFormat.Html, XHTMLValidationType.None);
            htmldoc.Sections[0].PageSetup.Orientation = PageOrientation.Landscape;
            htmldoc.SaveToFile("10020.pdf", FileFormat.PDF);


Sincerely,
Betsy
E-iceblue support team
User avatar

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

Tue Mar 14, 2017 9:11 pm

Hi Betsy,

I'm using Spire.Pdf because I require converting a HTML string, rather than a document/file.

akarina94
 
Posts: 3
Joined: Tue Mar 14, 2017 1:53 am

Wed Mar 15, 2017 2:00 am

Dear akarina94,

Thanks for your information.
Please use the method AppendHTML which meets your requirement in Spire.Doc, here is sample code for your reference.
Code: Select all
            string HTML = File.ReadAllText(@"F:\SpirePdfTest.txt");
            Document doc = new Document();
            Section sec = doc.AddSection();
            sec.PageSetup.Orientation = PageOrientation.Landscape;
            Paragraph par = sec.AddParagraph();
            par.AppendHTML(HTML);         
            doc.SaveToFile("Result.pdf", FileFormat.PDF);

If there is any question, please let me know.

Sincerely,
Betsy
E-iceblue support team
User avatar

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

Thu Mar 16, 2017 8:00 am

Dear akarina94,

Did you test the method I mentioned ? Did it meet your needs ?

Thanks,
Betsy
E-iceblue support team
User avatar

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

Return to Spire.PDF