EDIT: Better explanation: Before setting a bounty for this question I want to state clearer what I need:
I need .NET library for generating printable documents. Users should be able to print exactly the same document that they see either using my application or using external tool (like Adobe Acrobat reader). It does not have to be library for generating PDF documents, any document format that satisfies above condition will do.
I need the library to support following scenarios:
Scenario 1:
- I create text in some font and color.
- I ask the library for the width if this text if printed.
- I compute position([X,Y] coordinates on page) of this text based on information from 2. and have the library to print in at this position on a page.
Scenario 2:
- I create a text with some parts of it in superscript. All parts of text (normal and superscript) are in same (but variable) font.
- I ask the library what is the width if this text when printed. I get correct answer that also takes kerning between normal text and superscript into account.
- I compute position([X,Y] coordinates) on a page where this text should be printed (using its width from step 2.). I let the library to print it at this position. Printed on the page it has exactly the width that was returned by library in previous step.
Note for second scenario: I have text with some parts in superscript - example AAA{v-superscript text}BBB
(where text in {}
braces is superscript). The library needs to be able to print this text using correct kerning. Without right kerning there will be the same gap between last A
and first superscript v
as between last superscript t
and first B
. For the user it will look like there is a space between A
and superscript v
but no space after the last superscript letter. So the text will look ugly. If the library is to handle this correctly it would have method to print the whole text AAA{v-superscript text}BBB
at once with specification that a part of it is in superscript. Then it would use correct kerning between normal text and superscript.
Scenario 3:
- I want to print picture that consists of lines, circles, filled circles, letters and bezier curves on exact point in a page. I need to specify width of lines and circles. All shapes needs to be printed in pixel precision.
The library should be free of charge and not GPL (LGPL is ok). Is there something that allows me to do what I need ? Can it be done with iTextSharp (version 4.1.6 that is LGPL not AGPL)? Or perhaps with Fixed document ? Thank you for any suggestions.
Original question:
I need to typeset complex documents in .NET (C#) application for the user. Primary use of those documents will be for printing.
Documents will contain text and simple generated graphics. Layout of text and graphic will be complex and needs to be computed (in another words text position in document needs to be controlled by my code, it will not be done automatically by chosen library).
Here are my API requirements:
- function that returns exact width for given string and given font in which text should appear
- ability to position text to exact position on the page
- have text with some part of it in super script
- function to get exact width of some text that has some part of it in superscript
- ability to add pictures or even better option to draw simple graphics (line of given thickness, filled circle of given radius/diameter)
It does not have to be library for creating PDF documents - any other "what you see is what will be printed" document format will also do. If there is WPF component that can displays such documents it is an advantage. I know there is iTextSharp but is not easy to achieve 4. requirement with iTextSharp. Of course some PDF generation library that satisfies requirements above will be great solution too.
Thank you for ANY suggestions, I'm also happy to provide details or clearer explanation.
FixedPage
s but I still don't know how to createFixedPage
with some content in .NET. My question stackoverflow.com/questions/4634445/how-to-work-with-fixedpage is still unanswered. – Caveman