I have an existing PDF which has couple of lines of text and horizontal line in the top of every page. like full file name, date time, and a horizontal line below that. The positions, height and width are same on all pages/pdf files.
I would like to remove those two lines of text and the horizontal line using ABCPdf.
Thanks
Instead of remove the text (what may not possible), consider place a "white rectangle" hidding it. Then you can "stamp" the doc for a better "cammouflage".
Something like that, for each page:
yourDoc.Rect.SetRect ( coordinates ...)
yourDoc.Color.String = "255 255 255"
yourDoc.FillRect()
...
yourDoc.Flatten etc.
Related
I have an app that prints very small labels.
One thing I have noticed is that the printing (using DrawString with a rectangle) aligns text based on the TOP of the font ascender size. So when there are 2 font sizes on a line, you get this.
The PrintDocument object apparently has no ability to do line spacing or vertical alignment.
In other words I guess I need to calculate all that myself.
My main question is:
Is there another object I should be using where I can align text on the baseline, and "tighten" the vertical spacing to prevent my content from overrunning the labels? You know, like Word and LibreOffice?
Or do I have to reverse engineer it all in my code.
I have drawn my own field with Itextsharp and I want to add text to this field. This code is line.
I write some text, but I cannot write to the field I want. I have to write on the line. So I have to add the title to the top of the page. I tried to adjust the position, but I couldn't.
How do I adjust the text position?
Have you tried spacing?
p.SpacingAfter = 30;
or
p.SpacingBefore = 30;
Basically the iTextSharp has two ways of writing text.
One of them is the ContentByte, I think this is what you need.
I like to declare a global variable that stores the current position of contentByte. From it you can write the next element.
In this case you need to write the text at the top and then draw the shape from the final position of the text.
I’m writing an application that outputs a word file containing text an images. The blocks of text are of variable length. In some cases I want to know how much vertical space a block of text wil use in the document, given a certain width, so I can insert a page break to make it look nicer.
I’m using Microsoft.Office.Interop.Word
So the question is: Is it possible to calculate the resulting height given a certain width and a certain text style.
Cheers!
I am using latest version of Debenu Quick PDF Library.
Is it possible to calculate the height of DrawHTMLText before drawing it on document?
I need it because, I want my application to decide where (x,y coordinates) to draw DrawHTMLText according to its dimensions.
For example if it exceeds document border from the bottom side I want it to pull it up to make it fit.
Thank you.
user3253797,
You can use the GetHTMLTextHeight function to determine the height before calling DrawHTMLText.
http://www.debenu.com/docs/pdf_library_reference/GetHTMLTextHeight.php
Note : DrawHTMLText will return any overflow text as a string that will not fit into the specified area. GetHTMLTextHeight should in theory return the text height for the text that can fit inside the box. If the text is too long to fit inside the one box then it sounds like you will need to modify the x,y positions and possibly the HTML text itself to make it all fit on one page.
Good luck.
Andrew.
I have to print invoices from my software. I created the layout with Adobe Illustrator and saved it as a PNG image. My original idea was printing the layout as a background and then print the actual data taken from the database. I printed my layout inside my function and then I measured the various boxes of the layout for correctly placing my text. The problem is that my text is not printed in the correct position that I've found. I tried to change the margins to 0 but it seems to have no effect. I want this: if I choose to print my text line at x=10 mm and y=20mm the text must be phisically printed in this position without scaling/translating, also my background image.
Can you help me?
Try using (e.g.) e.Graphics.PageUnit = GraphicsUnit.Milimeter, and then simply specify the desired values using the Graphics.DrawString Method