Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

Converting an HTML document with images to PDF

Last post 01-19-2011, 7:04 AM by aspose.notifier. 13 replies.
Sort Posts: Previous Next
  •  09-01-2010, 12:06 PM 256623

    Converting an HTML document with images to PDF .NET

    Attachment: Present (inaccessible)
    Hi Aspose support team,

    I have Aspose.Words and I'm trying to convert an HTML document that includes image URLs to PDF.

    I'm currently trying to embed the image (base64) on the HTML document and then using the resulting binary with method Aspose.Words.Doc2PDF. Still the image isn't rendered in the PDF.

    What is the recommended procedure for this?

    Thanks in advance.
     
  •  09-01-2010, 12:53 PM 256642 in reply to 256623

    Re: Converting an HTML document with images to PDF

    Hi

     

    Thanks for your request. Could you please attach your input HTML document here for testing? I will investigate the issue and provide you more information.

     

    Best regards,


    Andrey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  09-01-2010, 6:49 PM 256688 in reply to 256642

    Re: Converting an HTML document with images to PDF

    I've added an example in attach of the post.

    The picture we're trying to have converted is the one put inline (base 64) although we'll also be able to have them separately (URL) added, if that's part of the procedure you'll recommend.
     
  •  09-02-2010, 5:12 AM 256791 in reply to 256688

    Re: Converting an HTML document with images to PDF

    I'm also having trouble passing some styles to the PDF, for example font type.

    For an HTML like:

    <span style="color:white; font-size:16px;font-weight: bold; font-family:arial;">

    I still get Times New Roman (or similar) on the PDF.

    Thanks in advance for the help on these 2 issues.
     
  •  09-02-2010, 6:09 AM 256799 in reply to 256791

    Re: Converting an HTML document with images to PDF

    Hello

     

    Thank you for additional information. Regarding base64 data in your HTML, currently Aspose.Words does not support base64 data upon HTML import. We will consider an ability to support this and provide you more information. As a workaround please try using direct url to image.

    Also I managed to reproduce the problem with font. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

     

    Best regards.


    Andrey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  09-02-2010, 6:18 AM 256800 in reply to 256799

    Re: Converting an HTML document with images to PDF

    Hi,

    using a URL the image is not included in the HTML binary that is sent to Doc2PDF. That's why we tried embedding it in the HTML.

    Could you, perhaps, provide an example of the procedure (HTML and C# code) you're recommending?
     
  •  09-02-2010, 7:32 AM 256815 in reply to 256800

    Re: Converting an HTML document with images to PDF

    Hello

     

    Thanks for your inquiry. Actually, images usually are not included into HTML document. When you open HTML, like the following, using Aspose.Words, it will get image from URL and embed it into a final document.

     

    <html>

    <body>

        <img src="http://www.aspose.com/Images/aspose-logo.jpg" />

    </body>

    </html>

     

    Best regards,


    Andrey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  09-02-2010, 7:50 AM 256820 in reply to 256815

    Re: Converting an HTML document with images to PDF

    Thanks Andrey,

    I was referring about an example on to have such HTML being converted into a PDF. Can this be done with Aspose.Words? If so, could you provide an example? If not, how could this be done (also with an example, if possible)?
     
  •  09-02-2010, 8:26 AM 256825 in reply to 256820

    Re: Converting an HTML document with images to PDF

    Hello

     

    Thanks for your request. Please see the following code:

     

    // Open HTML

    Document doc = new Document(@"in.html");

     

    // Save output document

    doc.Save(@"out.pdf");

     

    or you can try using this code to insert HTML and save as PDF

     

    // Create an empty Document

    Document doc = new Document();

     

    DocumentBuilder builder = new DocumentBuilder(doc);

     

    builder.InsertHtml(

        @"<html>

            <body>

                <img src='http://www.aspose.com/Images/aspose-logo.jpg' />

            </body>

         </html>");

     

    // Save output document

    doc.Save(@"out.pdf");

     

    Hope this helps.

     

    Best regards,


    Andrey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  09-02-2010, 3:18 PM 256889 in reply to 256825

    Re: Converting an HTML document with images to PDF

    Hi Andrey,

    we've replaced our use of Aspose.Words.Doc2PDF method by the code you've recommended and it worked pretty well.

    Thanks!
     
  •  09-03-2010, 10:05 AM 256997 in reply to 256889

    Re: Converting an HTML document with images to PDF

    Actually, everything is working fine with the images, but now we are having problems with the inline fonts.

    Basically the inline fonts are not showing up on the document.

    thank you,

    Vasco

     
  •  09-03-2010, 11:03 AM 257014 in reply to 256997

    Re: Converting an HTML document with images to PDF

    Hi Vasco,

     

    Thanks for your inquiry. Your request has been linked to the appropriate issue. We will be sure to inform you of any developments regarding this problem.

     

    Best regards,


    Andrey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  10-30-2010, 3:52 PM 266665 in reply to 257014

    Re: Converting an HTML document with images to PDF

    The issues you have found earlier (filed as 9180) have been fixed in this update.  


    Alexey Noskov
    Developer/Technical Support
    Aspose Auckland Team
     
  •  01-19-2011, 7:04 AM 279617 in reply to 256623

    Re: Converting an HTML document with images to PDF

    The issues you have found earlier (filed as 19752) have been fixed in this update.


    This message was posted using Notification2Forum from Downloads module by aspose.notifier.
     
View as RSS news feed in XML