911 questions
0 votes
2 answers
188 views
Implementation of PdfSharp IFontResolver causes .NET MAUI app for Android to crash
In a .NET MAUI 9 app I use PdfSharp.Maui (1.0.5) to create a pdf document. I don't use PdfSharp.Maui directly but rather PDFsharp which is a transitive package: using (PdfDocument document = new ...
0 votes
1 answer
123 views
PdfSharp's PdfDocument.AcroForm.Fields contains less text input fields than the PDF in Adobe
TL;DR: I want to replace text input fields in a PDF with strings but they are duplicated and this is difficult with PdfSharp. Does anyone know a library which makes this easy? I am trying to replace ...
1 vote
1 answer
127 views
PDFSharp and Edge 137 - 138
The code below is working fine for most web Brower but I am seeing problems with edge browser 137 and 138. In Edge browser 137 and 138 keep asking for owner password and went I enter in the password ...
0 votes
1 answer
60 views
Get ID of string element created using PdfSharp XGraphics.DrawString
When using the PdfSharp NuGet package, I can create string elements in a PDF document, but because the XGraphics.DrawString does not return a value I cannot identify the element it has created. I am ...
1 vote
1 answer
123 views
PdfSharp class "PdfSignatureField" not working
Building a webapp with C# and Blazor. I have a function in one of my .cs files that uses PdfSharp to generate a PDF based on data from a dictionary. I'm trying to add a signature field that will allow ...
-1 votes
1 answer
163 views
Converting png to pdf in Azure function with PdfSharp
I am creating an Azure function to convert a png (stored in the blob store) to a pdf and upload it to the blob store. My code is failing for pngs over ~4000 pixels. I have tried to amend my method for ...
-1 votes
1 answer
327 views
PdfSharp 'Unsupported image format' using XImage
I am to creating an Azure function with a method that converts a png to a pdf. The method takes a byte array (png) and I want to output a byte array (pdf). I am then uploading the pdf to the blob ...
-1 votes
1 answer
75 views
Converting png bytes to pdf bytes
I'm trying to write a method in my Azure Function using PdfSharp that will download a png from a url, convert it to a pdf and upload it to the blob store. However, I keep running into an issue with ...
0 votes
1 answer
150 views
How to get shapes from PDF using PDFsharp
I have a file and draw a rectangle in it. var brush = new XSolidBrush(XColor.FromArgb(255, colorArray.R, colorArray.G, colorArray.B)); XGraphics gfx = XGraphics.FromPdfPage(document.Pages[0]); gfx....
1 vote
1 answer
111 views
C# COM INTEROP and VB6 - Resources not being released
I have a C# .netFramework4.8 COM INTEROP library that takes data and puts it into a .pdf file to be saved somewhere. This involves PDFSharp, as I need to take pages out of existing .pdf files and ...
-1 votes
2 answers
218 views
What are the alternatives to using a MemoryStream twice here?
I'm trying to write code that stamps a passport with the system users name, date and an image of their signature (which I store as a varbinary in the sql database and byte in the model). Here is my ...
-1 votes
1 answer
112 views
Trying to print base64 document fails with "parameter is not valid"
I am trying this: try { using (var memoryStream = new MemoryStream(pdfBytes)) { // Load the PDF document PdfSharp.Pdf.PdfDocument pdfDocument = PdfReader.Open(memoryStream, ...
1 vote
1 answer
921 views
In PDFsharp, the Width and Height of PdfPage appear to be marked obsolete. How to fix all the warnings?
For example this line: gfx.DrawString( "Bit Depth: " + lightning.BitDepth, new XFont("Arial", 14), XBrushes.Black, new XRect(50, 330, page.Width, page.Height), ...
0 votes
2 answers
81 views
Copy a PDF avoids reading from several users
I made a small function, that reads a PDF, adds some table on original PDF, then saves as a new file. The problem is when I use it, it seems to block the original file, and several users cannot read ...
0 votes
1 answer
149 views
How to add Alt Text to MigraDoc PDF Image
I'm using MigraDoc to layout PDF documents, which are generated with PDFSharp. I would like to add Alt Text to images. Intuitively, I would expect that the Image would have a property such as AltText, ...