GdPictureDocumentConverter HTML

Discussions about image processing and document imaging.
Post Reply
gaser
Posts: 2
Joined: Tue Mar 16, 2021 5:12 pm

GdPictureDocumentConverter HTML

Post by gaser » Wed Mar 17, 2021 9:18 am

Hi,

i want to convert a simple html file to pdf. I used the following example code.

Code: Select all

using (GdPictureDocumentConverter gdpictureDocumentConverter = new GdPictureDocumentConverter())
{
    // Set the text and document properties to be used for the resulting file.
    gdpictureDocumentConverter.HtmlPageHeight = 842; // A3 page size
    gdpictureDocumentConverter.HtmlPageWidth = 1191;  // A3 page size
    gdpictureDocumentConverter.HtmlPageMarginTop = 10;
    gdpictureDocumentConverter.HtmlPageMarginBottom = 10;
    gdpictureDocumentConverter.HtmlPageMarginLeft = 10;
    gdpictureDocumentConverter.HtmlPageMarginRight = 10;
 
    using (Stream inputStream = File.Open("input.html", System.IO.FileMode.Open))
    {
        using (Stream outputStream = File.Create("output.pdf"))
        {
            gdpictureDocumentConverter.ConvertToPDF(inputStream, GdPicture14.DocumentFormat.DocumentFormatHTML, outputStream, PdfConformance.PDF1_5);
        }
    }
}
My html file:

Code: Select all

<html>

<h1>Hello World</h1>
test

</html>
The programm creates every time a 0 bytes pdf file. I got no exceptions. The license is valid, other gdpicture code works fine (except word to pdf)
I used GdPicture.NET Document Imaging SDK Ultimate V14.1.0.107

any suggestions?

Best Regards Oliver

User avatar
Loïc
Site Admin
Posts: 5881
Joined: Tue Oct 17, 2006 10:48 pm
Location: France
Contact:

Re: GdPictureDocumentConverter HTML

Post by Loïc » Sun Mar 21, 2021 11:11 pm

Hello Olivier,

Problem is resolved for the next minor release.

If you want an immediate solution please replace:

Code: Select all

using (Stream inputStream = File.Open("input.html", System.IO.FileMode.Open)
)

by

Code: Select all

using (Stream inputStream = File.Open("input.html", System.IO.FileMode.Open, FileAccess.Read, FileShare.Read))

With best regards,

Loïc

dblalock
Posts: 4
Joined: Fri Jul 31, 2020 7:39 pm

Re: GdPictureDocumentConverter HTML

Post by dblalock » Fri Mar 26, 2021 1:01 am

Loïc wrote:
Sun Mar 21, 2021 11:11 pm
Hello Olivier,

Problem is resolved for the next minor release.

If you want an immediate solution please replace:

Code: Select all

using (Stream inputStream = File.Open("input.html", System.IO.FileMode.Open)
)

by

Code: Select all

using (Stream inputStream = File.Open("input.html", System.IO.FileMode.Open, FileAccess.Read, FileShare.Read))

With best regards,

Loïc
Neither the original example or this works for me -- they both result in a 0 byte file.
  • Was this fixed in 14.1.108 (March 23rd 2021)?
  • Is HTML conversion to PDF working at all?

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest