Welcome Guest Search | Active Topics | Sign In | Register

Best way to add HTML starting with EO.PDF.Acm Options
Bryson
Posted: Sunday, January 19, 2014 1:09:42 PM
Rank: Newbie
Groups: Member

Joined: 1/18/2014
Posts: 7
I am currently evaluating your EO.PDF library to be used within some of our projects. I am having difficulty however finding a way to place formatted HTML on a page generated with with your EO.PDF.Acm library. We have formatted HTML (stored in a db, such as bulleted lists) that we we would like to add to pages that have been created/rendered manually with your abstract content model. Your documentation seems to imply that this is possible, however I can't seem to understand how to position it correctly in a page that has already has been rendered with ACM.

I was disappointed to see that there isn't a method to easily do this. I don't know if this is possible given your current framework, but from what I'm reading on the net there seems to be quite the demand for this. Something like a AcmHtml content object similar to the AcmParagraph object would be an awesome feature addition.

Any guidance on this would be greatly appreciated! Angel
eo_support
Posted: Sunday, January 19, 2014 1:39:17 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

There are two things involved. The first is you need to specify the target page. The second is that you need to specify the target location.

To specify the target page, you would call ConvertHtml(html, pdfPage). For example, the following code put your HTML on the first page of the PdfDocument:

Code: C#
//Note here the second argument is a PdfPage object, not a PdfDocument object
HtmlToPdf.ConvertHtml(html, doc.Pages[0]);


The second thing is you need to be able to position the HTML. There are two ways to do that:

1. Set HtmlToPdf.Options.OutputArea:

http://www.essentialobjects.com/doc/4/htmltopdf/page_size.aspx

Basically, if you want your HTML to appear at x = 4 inch, y = 5 inch, you set your page to have a 4 inch margin on the left and 5 inch margin on the top.

2. Alternatively, you can use the default margin but use absolute positioning in your HTML. For example, instead of convert "some text", you can convert:

Code: HTML/ASPX
<div style="left:100px;top:200px;">some text</div>


Here the outter DIV is used to position the text.

Hope this helps. Please feel free to let us know if there is anything else.

Thanks!
Bryson
Posted: Monday, January 20, 2014 2:19:59 PM
Rank: Newbie
Groups: Member

Joined: 1/18/2014
Posts: 7
Thank for the quick response! I really appreciate it. I think I understand what you're saying and it makes sense except for one thing.

If you begin by rendering items with ACM, how do you find the latest rendering position using ACM to then begin rendering HTML? I can't seem to see where this is done.
eo_support
Posted: Monday, January 20, 2014 2:26:17 PM
Rank: Administration
Groups: Administration

Joined: 5/27/2007
Posts: 24,196
Hi,

I believe you can do it by calling CreateDestination method on the last AcmContent object:

http://www.essentialobjects.com/doc/4/eo.pdf.acm.acmcontent.createdestination.aspx

That should give you a PdfDestination object, you can then check the object's FitRect property:

http://www.essentialobjects.com/doc/4/eo.pdf.pdfdestination.fitrect.aspx

Note that the value in the FitRect property is in 1/72 inch. You can then device this value by 72, then pass it to HtmlToPdf.Options.StartPosition property:

http://www.essentialobjects.com/doc/4/eo.pdf.htmltopdfoptions.startposition.aspx

Hope this helps. Please feel free to let us know if you still have any more questions.

Thanks!


You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.