pdfsharp

Why some fonts (e.g. Code 128) work locally but not in server when generating pdf file with PDFsharp

流过昼夜 提交于 2020-01-07 06:05:20
问题 I'm creating some labels with PDFsharp (using ASP.Net+VB) and everything works OK in my development PC: the PDF file shows correctly the sizes and fonts I choose (Code 128, for barcodes, and Arial. Booth are ttf). When publishing the code to the server the generated PDF shows Microsoft Sans MS instead of Code 128 . The pdf is being generated in the server and downloaded to the client (My PC), and I can't see the bar codes in generated PDF neither in server nor in client. I'm sure the font is

PDFsharp: The name 'Process' does not exist in current context

元气小坏坏 提交于 2020-01-06 04:23:25
问题 I have been trying to install the PDFsharp library for the purpose of writing PDF records and came across a problem. It keeps saying that the Process does not exist in current context. I did a google and had no luck and a tinker to see if I can get it to work and no luck either. Below is the code I am using to test the library (pulled from the PDFsharp wiki) PdfDocument document = new PdfDocument(); document.Info.Title = "Created with PDFsharp"; PdfPage page = document.AddPage(); XGraphics

How to place an image and a paragraph on PDF document header?

蹲街弑〆低调 提交于 2020-01-06 03:31:25
问题 I'm trying to place an image and a text below this image on document header using MigraDoc . Unfortunately I'm unable to do so. It seems to only be accepting image or paragraph but not both. This is what I've tried: var image = section.Headers.Primary.AddImage("image.jpg"); var text = section.Headers.Primary.AddParagraph("title"); It may be possible that paragraph is placed under image, making it invisible. It doesn't seem to be the case though. 回答1: You can add images to paragraphs - you add

MigraDoc: How do I add preceding spaces to a String?

大城市里の小女人 提交于 2020-01-05 02:58:47
问题 I have a table of text data and I'd like to indent certain pieces of data by a couple spaces, but everything I try seems to result in my string being automatically trimmed, and the preceding spaces are deleted. The PDF as it is right now looks something like this: http://i.imgur.com/KBK6jWS.png So for example, I'd like to indent 'LiabilityOne' and 'LiabilityTwo' a bit. I've tried adding spaces in the String as it's rendered. Adding spaces before it's rendered, using '\x020' in hopes that'd

C# Extract Text by using PdfSharp return unreadable content

感情迁移 提交于 2020-01-04 09:40:05
问题 I managed to extract text from PDF version 1.2 by using PdfSharp as refer to this link My code to extract text private string ExtractText(CObject cObject, ref string pdfcontentstr) { if (cObject is COperator) { var cOperator = cObject as COperator; if (cOperator.OpCode.Name == OpCodeName.Tj.ToString() || cOperator.OpCode.Name == OpCodeName.TJ.ToString()) { foreach (var cOperand in cOperator.Operands) { ExtractText(cOperand, ref pdfcontentstr); } } } else if (cObject is CSequence) { var

PDFsharp draws text under graphics

浪子不回头ぞ 提交于 2020-01-02 15:41:08
问题 I am using PDFsharp to generate a PDF document from scratch. I am trying to write text on top of a gradient filled rectangle. After generating the document, the gradient appears on top of the text rendering the text completely hidden. using (var document = new PdfDocument()) { var page = document.AddPage(); var graphics = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append); graphics.SmoothingMode = XSmoothingMode.HighQuality; var bounds = new XRect(graphics.PageOrigin, graphics

PDFsharp draws text under graphics

风流意气都作罢 提交于 2020-01-02 15:40:47
问题 I am using PDFsharp to generate a PDF document from scratch. I am trying to write text on top of a gradient filled rectangle. After generating the document, the gradient appears on top of the text rendering the text completely hidden. using (var document = new PdfDocument()) { var page = document.AddPage(); var graphics = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append); graphics.SmoothingMode = XSmoothingMode.HighQuality; var bounds = new XRect(graphics.PageOrigin, graphics

PDFsharp draws text under graphics

霸气de小男生 提交于 2020-01-02 15:39:06
问题 I am using PDFsharp to generate a PDF document from scratch. I am trying to write text on top of a gradient filled rectangle. After generating the document, the gradient appears on top of the text rendering the text completely hidden. using (var document = new PdfDocument()) { var page = document.AddPage(); var graphics = XGraphics.FromPdfPage(page, XGraphicsPdfPageOptions.Append); graphics.SmoothingMode = XSmoothingMode.HighQuality; var bounds = new XRect(graphics.PageOrigin, graphics

How to Define a PDF Outline Using MigraDoc

六眼飞鱼酱① 提交于 2020-01-02 07:44:32
问题 I noticed when using MigraDoc that if I add a paragraph with any of the heading styles (e.g., "Heading1"), an entry is automatically placed in the document outline. My question is, how can I add entries in the document outline without showing the text in the document? Here is an example of my code: var document = new Document(); var section = document.AddSection(); // The following line adds an entry to the document outline, but it also // adds a line of text to the current section. How can I

How to extract FlateDecoded Images from PDF with PDFSharp

*爱你&永不变心* 提交于 2020-01-02 06:36:21
问题 how do I extract Images, which are FlateDecoded (such like PNG) out of a PDF-Document with PDFSharp? I found that comment in a Sample of PDFSharp: // TODO: You can put the code here that converts vom PDF internal image format to a // Windows bitmap // and use GDI+ to save it in PNG format. // [...] // Take a look at the file // PdfSharp.Pdf.Advanced/PdfImage.cs to see how we create the PDF image formats. Does anyone have a solution for this problem? Thanks for your replies. EDIT: Because I'm