pdfsharp

PdfSharp - Wrong PDF page settings when document is opened in Acrobat

孤街醉人 提交于 2019-12-09 10:20:38
问题 I have written a piece of code which uses the PdfSharp library. The instance of PdfSharp.Pdf.PdfDocument created saves to disk as expected. The right content is displayed, but onto the wrong page settings. The default page settings for PdfSharp are: PdfSharp.PageSizes.A4 PdfSharp.PageOrientation.Portrait My problem is that these settings seem to override the required settings. I create the instance of PdfDocument class and adds a new instance of PdfPage class to its Pages collection property.

PDFsharp on Azure with Custom Fonts

谁说胖子不能爱 提交于 2019-12-09 03:15:31
I am using a webapp on azure to create a PDF using PDFsharp 1.32. As it is a Azure webapp I cannot install fonts. Therefore I am using the following with embedded font options: var globalFontCollection = XPrivateFontCollection.Global; _fontBytes = File.ReadAllBytes(_pathToFont); globalFontCollection.AddFont(_fontBytes, _fontName); However this does not work. There is no error just acts as if the font is not known and falls back to the default. If I install the font it works so I know the rest of the code is correct. Other code shows using AddFont with different parameters however those are not

Add acroform with pdfsharp

半城伤御伤魂 提交于 2019-12-08 16:53:23
问题 how can i add Acroforms (or any inputfields) with pdfsharp lib to a pdf? For example a textbox (PdfSharp::Pdf::AcroForms::PdfTextField) I can't find any example for this, only read/modify. I found "page->Elements->Add(key,pdfitem)", but i cant create a Object from PdfSharp::Pdf::AcroForms::PdfTextField or the others Forms (no Constructor) 来源: https://stackoverflow.com/questions/25222759/add-acroform-with-pdfsharp

Pdfsharp Out of Memory Exception when Combine Multi Pdf File

∥☆過路亽.° 提交于 2019-12-08 14:12:21
问题 I have to convert into a single pdf a large number (but undefined) pdf into one for this, I'm using the code PDFsharp here. // Get some file names string[] files = filesToPrint.ToArray(); // Open the output document PdfDocument outputDocument = new PdfDocument(); PdfPage newPage; int nProcessedFile = 0; int nMemoryFile = 5; int nStepConverted = 0; String sNameLastCombineFile = ""; // Iterate files foreach (string file in files) { // Open the document to import pages from it. PdfDocument

c# PDFSharp - what's the point of Table.Clone?

霸气de小男生 提交于 2019-12-08 04:00:31
问题 I am generating a PDF document using PDFSharp which uses the same (small) table over and over. I saw that it is possible to clone an entire table. I made a master table with all the core settings I would need and a couple of rows, thinking i could simply use the Table.Clone() method on the master table to bring be back a nice new table that could be midified and then drawn to the document. Cloning works, but when it comes to actually draw the table to the page, an System.ArgumentFormat

How to set DPI (dots per inch) in PDFsharp

断了今生、忘了曾经 提交于 2019-12-07 02:19:48
问题 Is there any way to set DPI (dots per inch) in case of PDFsharp? Thanks 回答1: No, PDF files are vector files that have no DPI. If your question is about images stored in the PDFfile: PDFsharp stores images as they come. PDFsharp does not (yet) resize images to lower DPI to reduce the file size. Your application knows which image will be used where and at which size, so you should reduce the raster images to the DPI (*) you need before using them with PDFsharp. Please note that images will be

How do I walk through tree of Pdf Objects in PDFSharp?

半腔热情 提交于 2019-12-07 00:57:29
问题 I am trying to to walk though the tree of PdfItem objects in an existing PDF document using PDFSharp in c#. I want to create a hierarchy of all the objects as I go along -- similar to what the "PDF Explorer" example does -- but I want it to be a tree instead of a flat list of all the objects. The root node is document.Internals.Catalog. And I want to to walk down through all the document.Internals.Catalog.Elements until I have visited every element. One of the problems I run into is that

Split multi-page PDFs based on barcode on page till the next unique barcode

╄→尐↘猪︶ㄣ 提交于 2019-12-06 14:50:24
问题 I have VB.NET code that works for one file so far and it splits that file based on a unique bar code that is on each page to identify it. Each barcode is one of: COVERSPLIT COMPLAINTSPLIT EXHIBITSPLIT MILSPLIT SUMSPLIT The problem is: say, for instance, the first page has the barcode of COVERSPLIT because it's a coversheet, but the next sheet is also a coversheet but it does not have the barcode on it. So when I run my code it's only extracting the sheets with those identified barcodes and

Align Page Number to Right Corner in MigraDoc

安稳与你 提交于 2019-12-06 14:49:53
I know how to show page numbers and how to align them in footer. However my problem is that my Footer contains some custom text which should be left aligned and page number should be aligned to right corner. string footer = "My custom footer"; Paragraph footerParagraph = section.Footers.Primary.AddParagraph(footer); footerParagraph.AddTab(); footerParagraph.AddPageField(); Above will generate "My custom footer 1" for page 1, I need page nmuber to be right at the right most corner of the page. I can add extra spaces or tab but thought there must be a clean way to achieve this. Thanks. Keep it

Image Opacity in PdfSharp.NET

为君一笑 提交于 2019-12-06 11:25:26
I'm using PDFSharp.NET library to watermark a list of PDFs file. Everything works fine, the website has a lot of samples. http://www.pdfsharp.net/wiki/Graphics-sample.ashx The last thing I need is to add the Company Logo, which is big, in the middle of the PDF Page. I can use a PNG, so that areas which are set as transparent do not "cover" the PDF page". The pdf is not generated using PDFSharp, but is an "Image" PDF. For this reason, what I need, is, in addition to the transparency, which works, be able some how to set the Image Opacity! The code to place the image is this one: XGraphics gfx =