Welcome Guest Search | Active Topics | Sign In | Register

ACM Formatting vs HTML in PDF Options
kizel
Posted: Monday, September 17, 2012 5:13:06 PM
Rank: Member
Groups: Member

Joined: 8/27/2012
Posts: 11
I'm not sure if ACM has the same capabilities as HtmlToPdf, so I understand if this isn't possible...

1) I need to use ACM to add headers to a PDF. The header is an AcmTable which I want to have a very thin border. When I make a 1px border in html/css and use ConvertHtml(), it produces a very thin line in the PDF. But I can't seem to make the border line this thin when using ACM. Even using 0.0001f creates a border equivalent to a 2px css border. Is it possible to make a border this thin using ACM?

2) When I use an html line break <br> and convert to pdf, it leaves almost no line spacing. Using block paragraph, and line breaks in ACM leaves extra line spacing. I've tried all relevant style settings, but nothing helped. Is there a way to prevent this extra line spacing when using ACM?
eo_support
Posted: Monday, September 17, 2012 6:44:54 PM
Rank: Administration
Groups: Administration

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

No. ACM does not have the same capability as HtmlToPdf. These two compliments each other. They do not replace each other. As to your questions:

1. AcmTable should be able to produce thin lines. If you still have problem, please try to isolate the problem into a small test program and we will be happy to take a look;

2. Again, that should not happen, you can post test code and we will take a look;

Thanks!
kizel
Posted: Wednesday, September 19, 2012 11:53:28 AM
Rank: Member
Groups: Member

Joined: 8/27/2012
Posts: 11
Here is a test, the border is thicker, and there is a more line spacing between the text:

Code: C#
PdfDocument doc = new PdfDocument();
string html = "&lt;div style='font:12pt arial; border:1px solid black;'&gt;Test Border&lt;br/&gt;And Line Break&lt;/div&gt;";

HtmlToPdfResult pdf_result = HtmlToPdf.ConvertHtml(html, doc);

AcmText txt1 = new AcmText("Test Border");
AcmLineBreak brk = new AcmLineBreak();
AcmText txt2 = new AcmText("And Line Break");
AcmBlock blk = new AcmBlock(txt1, brk, txt2);

blk.Style.FontName = "arial";
blk.Style.FontSize = 12;
blk.Style.Border = new AcmBorder(.001f);

AcmRender render = new AcmRender(doc.Pages[0], 0, new AcmPageLayout(new AcmPadding(1, 2, 1, 1)));   
render.Render(blk);

doc.Save(file_path);
eo_support
Posted: Wednesday, September 19, 2012 2:08:26 PM
Rank: Administration
Groups: Administration

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

We have posted a new build that should address both issues for you. Please see your private message for the download location.

The new build will honor thin lines. To create a line that is close to 1px, you can use a value of 0.01 (the exact value should be 1/96, assume your system's DPI is 96).

To create the same line height as the HTML to PDF converter, you must use set Style.LineHeight to 0.

Code: C#
//Use minimum line height
blk.Style.LineHeight = 0;


Without this line AcmRender will use the "optimal" line height by automatically adding some space between text lines.

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

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.