We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

PDFLogicDocument and PDFDocument Together?

Is there a way to add the content of a PDFLogicDocument to a PDFDocument? From the samples, I can see that PDFDocument has more flexibility then the PDFLogicDocument. If that is not possible, is there a way to take the HTMLToDLS convertor.Convert("html string") results and add that to a PDFDocument and not a PDFLogicDocument? Thanks in advance.

13 Replies

AJ Ajish Syncfusion Team June 8, 2006 11:07 AM UTC

Hi, Sorry for the inconveniece. It is not possible to use HTMLToDLS convertor along with GridModel[PDFDocument] it can only be used with FlowModel[PDFLogicDocument]. However we do have othere options to convert a webpage,HTMLDocuments and HTML string into PDF using GridModel[PDFDocumnt]. The following is the options available 1) HTMLConvertor can only be used to convert WebPages and HTML pages to PDF it is done with the help of HtmlConverter.Base.dll. The HTMLConverter uses the MSHTML rendering library to render HTML documents. Here is a sample to do this: WebPageToPDF.zip 2) To import HTMLstrings into PDFDocument use Essentail HTMLUI which would convert HTML document/Strings to a image. This image can be easily imported to PDF document. Here is a sample fo your reference: HTMLToDoc.zip Please take a look at the sample and let me know if you any other questions. Thanks, Ajish.


AD Administrator Syncfusion Team June 9, 2006 06:58 PM UTC

Thanks Ajish, The HTMLToDoc.zip is what I am looking for. One question, the height of the created image is not accurate. If I put two created images, one right after the other, it puts a lot of space between the two. The more information I add to the first image does not seem to grow the "image" height in proption it keeps the second image in the same location. Is there something I can do to get a more accurate height of the created image? I am attaching my generated PDFs to show you the image heights. Thanks for the help!

testing1.zip


AD Administrator Syncfusion Team June 9, 2006 08:57 PM UTC

Actually, after running some more tests in Debug mode, I noticed the image height is adjusted but the DrawImage point on the PDF page is not being adjusted correctly. Is there a buffer that the PDF DrawImage puts around the images automatically? Can that be turned off? Bitmap bmpImg2 = CreateBitmap(); PointF point = new PointF(); point.X = 0; point.Y = bmpImg.Height; // Height of first image pdfDoc.LastPage.Graphics.DrawImage(point, bmpImg2, props); >Thanks Ajish, > >The HTMLToDoc.zip is what I am looking for. One question, the height of the created image is not accurate. If I put two created images, one right after the other, it puts a lot of space between the two. The more information I add to the first image does not seem to grow the "image" height in proption it keeps the second image in the same location. Is there something I can do to get a more accurate height of the created image? I am attaching my generated PDFs to show you the image heights. > >Thanks for the help!

testing1.zip


AD Administrator Syncfusion Team June 12, 2006 01:28 PM UTC

Hi, Sorry for the delay in getting back to you. I was able to see the problem. I am investing on this issue I will send you an update regarding this as soon as possible. Thanks, Ajish.


AD Administrator Syncfusion Team June 13, 2006 10:25 PM UTC

Hi I was using the HTMLtoDoc sample file and I was noticing the image was being chopped off. If you see in the attachment DTO.pdf contains all of my section labels however the DTO2.pdf has data in it but it truncates the remaining sections. Here is the code I used to add the image to the pdf: IPDFGraphicState props = pdfDoc.CreateGraphicState(); props.SplitImages = true; Bitmap bmpImg = CreateBitmap(strHTML); pdfDoc.LastPage.Graphics.DrawImage(PointF.Empty, bmpImg, props); Thanks for your help.

PDFs.zip


AJ Ajish Syncfusion Team June 15, 2006 12:45 PM UTC

Hi Alex, Sorry for the delay in getting back to you. I was able to see the problem in the PDF files send by you. However I was unable to reproduce the problem with my test sample. Can you please send me your sample to reproduce this issue. So that I can investigate further on this. Thanks, Ajish.


AD Administrator Syncfusion Team June 16, 2006 01:34 PM UTC

Hi Ajish Here is some code that is printing ''Testing'' repeatedly and the last line is getting cut in half. I also created another table which contains ''W''s for text in the HTML string after all of the ''Testing'' paragraphs table and the ''W''s are overlapping with the last ''Testing'' paragraph. Thanks again for your help. Alex

PDF0.zip


AJ Ajish Syncfusion Team June 19, 2006 01:51 PM UTC

Hi Alex, Sorry for the delay in getting back to you. I was able to see that the html text is not proper in the given sample. Please note that the HTMLUI control expects clear HTML strings while rendering. The issue in that sample is
tag is placed in-between the tr tag and the table tag like this,
SomeText
I have replaced it like this,
SomeText
Here is the modified sample: HTMLUIToImage.zip Please take a look at the sample and let me know if you have any concerns. Thanks, Ajish.


AD Administrator Syncfusion Team June 19, 2006 06:30 PM UTC

Hi Ajish, Is there any update on the image height and width being generated by the sample and why the placement on the PDF page is not correct? Also, I am noticing the width of the converted HTML image does not cover the width of the page. Can that be controlled? I pass in HTML strings not a full HTML page. Thanks! >Actually, after running some more tests in Debug mode, I noticed the image height is adjusted but the DrawImage point on the PDF page is not being adjusted correctly. Is there a buffer that the PDF DrawImage puts around the images automatically? Can that be turned off? > >Bitmap bmpImg2 = CreateBitmap(); >PointF point = new PointF(); >point.X = 0; >point.Y = bmpImg.Height; // Height of first image > >pdfDoc.LastPage.Graphics.DrawImage(point, bmpImg2, props); >


AJ Ajish Syncfusion Team June 20, 2006 05:38 PM UTC

Hi, Sorry for the delay in getting back to you. I will send you an update reagarding this as soon as possible. Thanks, Ajish.


HK Henry Ko June 20, 2006 08:47 PM UTC

Hi Ajish, I tried your HTMLToDoc.zip sample program and was able to generate the PDF file, but the problem is the text quality is not good, looks like it''s printed by the dot-matrix printer using its draft mode. I noticed the sample HTML-Converted PDF documents on Syncfusion''s web site have the same problem too. Is there anything Syncfusion can do to improve the text quality in this case? >Hi, > >Sorry for the inconveniece. It is not possible to use HTMLToDLS convertor along with GridModel[PDFDocument] it can only be used with FlowModel[PDFLogicDocument]. However we do have othere options to convert a webpage,HTMLDocuments and HTML string into PDF using GridModel[PDFDocumnt]. The following is the options available > >1) HTMLConvertor can only be used to convert WebPages and HTML pages to PDF it is done with the help of HtmlConverter.Base.dll. The HTMLConverter uses the MSHTML rendering library to render HTML documents. > >Here is a sample to do this: WebPageToPDF.zip > >2) To import HTMLstrings into PDFDocument use Essentail HTMLUI which would convert HTML document/Strings to a image. This image can be easily imported to PDF document. Here is a sample fo your reference: HTMLToDoc.zip > >Please take a look at the sample and let me know if you any other questions. > >Thanks, >Ajish. > > > > >


AJ Ajish Syncfusion Team June 22, 2006 08:47 AM UTC

Hi, Sorry for the delay in getting back to you. Here is a modified sample which creates a image with respect to the pdf document page width. Sample:HTMLToDoc.zip The width of the image can be adjusted using the following code. doc.ClientSize = new Size(width,height); Please take a look and let me know if you have any questions. Thanks, Ajish. >Hi Ajish, > >Is there any update on the image height and width being generated by the sample and why the placement on the PDF page is not correct? Also, I am noticing the width of the converted HTML image does not cover the width of the page. Can that be controlled? I pass in HTML strings not a full HTML page. > >Thanks! > >>Actually, after running some more tests in Debug mode, I noticed the image height is adjusted but the DrawImage point on the PDF page is not being adjusted correctly. Is there a buffer that the PDF DrawImage puts around the images automatically? Can that be turned off? >> >>Bitmap bmpImg2 = CreateBitmap(); >>PointF point = new PointF(); >>point.X = 0; >>point.Y = bmpImg.Height; // Height of first image >> >>pdfDoc.LastPage.Graphics.DrawImage(point, bmpImg2, props); >> >


AD Administrator Syncfusion Team June 22, 2006 01:55 PM UTC

Hi Ajish, I fixed the HTML and it works good now. Thanks a lot for your help. Alex >Hi Alex, > >Sorry for the delay in getting back to you. I was able to see that the html text is not proper in the given sample. Please note that the HTMLUI control expects clear HTML strings while rendering. The issue in that sample is
tag is placed in-between the tr tag and the table tag like this, > >
SomeText
> >I have replaced it like this, > >
SomeText
> >Here is the modified sample: HTMLUIToImage.zip > >Please take a look at the sample and let me know if you have any concerns. > >Thanks, >Ajish. >

Loader.
Live Chat Icon For mobile
Up arrow icon