Nick Tullos
Nick Tullos

Reputation: 511

HiQPdf - Images missing in pdf

I want to convert an html string to pdf with images located at a specific location. I have the html code loaded into a string. I have the images that go with the html located in c:\temp\ . I can get this to work if I save the html string to a file as seen in the example below. I really dont need to write the html to a file. Does anyone have any ideas? I'm using the 3rd party component HiQPDF and I have already contacted them.

    private void ConvertToPDF(string htmlbody, string pdfname)
    {
        HtmlToPdf htmlToPdfConverter = new HtmlToPdf();
        // set a demo serial number
        htmlToPdfConverter.SerialNumber = "-- HiQPdf Serial Number --";
        htmlToPdfConverter.Document.Margins = new PdfMargins(5);

        //doesnt work
        htmlToPdfConverter.ConvertHtmlToFile(htmlbody, @"c:\temp\", pdfname);
        //works just fine :-( , but it forces me to save to the disk
        htmlToPdfConverter.ConvertUrlToFile(@"C:\temp\1Z7039680342477761-00a26b62-f6d3-47e3-92c3-18b907665aaa.html", pdfname);
        return;
    }

Upvotes: 0

Views: 2885

Answers (1)

Nick Tullos
Nick Tullos

Reputation: 511

Set the base URL as file:///C:\temp/ instead of "c:\temp". This information comes directly from hiqpdf support.

Upvotes: 1

Related Questions