pdf-generation

Convert XPS to PDF in WPF C# application

时光总嘲笑我的痴心妄想 提交于 2019-12-01 09:13:57
问题 I need to convert an XPS file I create with my application to a PDF file, what is the best way to do so? I prefer this to be done from inside C# using a managed assembly. Open source is preferred upon third party solutions 回答1: You can use the XpsDocument class to read the XPS files, then use a PDF library (such as Report.Net or #PDF) to export it. I used #PDF back in .NET 1.1, but not sure if it can be easily converted to .NET 2.0. #PDF: http://sharppdf.sourceforge.net/ Report.NET: http:/

NReco PDFGenerator issue

偶尔善良 提交于 2019-12-01 09:02:55
问题 I've been using this tool for about a week, and now, today, it just stopped working. I've reverted the rest of my code back to the previous state and I keep getting the same error. All that I'm getting from the Exception that is thrown is: An exception of type 'System.Exception' occurred in NReco.PdfGenerator.dll but was not handled in user code Additional information: Cannot generate PDF: (exit code: -1073740791) From the Windows Event Log: Faulting application name: wkhtmltopdf.exe, version

How to show save file dialog in Safari?

 ̄綄美尐妖づ 提交于 2019-12-01 08:54:32
问题 I need help. I have an angular app and by using DocRaptor want to generate PDF and save it as file. But I cant trigger the dialog to save file in Safari with any method what I have found on Stack Overflow. Those methods open file in current browser tab and replace site html or open file in new tab. No one cant shows the dialog. Here the examples what I have already tried to use. Environment MacOS - EL Capitan. Safari 9.0.3 Solution #1 var content = 'file content for example'; var blob = new

itextsharp add text over a circle image in a table cell

空扰寡人 提交于 2019-12-01 08:49:46
问题 I need to have a table with multiple columns where I have different coloured circles in different cells with a number in the middle of the circle. Similar to the mockup below but with everything centralized and equal. I have tried the following: PdfContentByte canvas = writer.DirectContent; PdfTemplate template = canvas.CreateTemplate(40, 40); template.SetLineWidth(1f); template.Circle(15f, 15f, 15); template.Stroke(); iTextSharp.text.Image img = iTextSharp.text.Image.GetInstance(template);

Calculate correct width of a text

烈酒焚心 提交于 2019-12-01 08:16:08
问题 I need to read a plan exported by AutoCAD to PDF and place some markers with text on it with PDFBox. Everything works fine, except the calculation of the width of the text, which is written next to the markers. I skimmed through the whole PDF specification and read in detail the parts, which deal with the graphic and the text, but to no avail. As far as I understand, the glyph coordinate space is set up in a 1/1000 of the user coordinate space. Hence the width need to be scale up by 1000, but

How to resize an iTextSharp.text.Image size into my code?

爷,独闯天下 提交于 2019-12-01 08:04:26
I am pretty new in iText nd iTextSharp (the C# version of iText) and I have the following problem. I am inserting some jpg charts inside my PDF. These charts are rapresented by some jpg like this one: I insert it into a table of my PDF in this way: iTextSharp.text.Image img = null; .......................................... .......................................... .......................................... if (currentVuln.UrgencyRating > 0) { img = ChartHelper.GetPdfChartV2((int)currentVuln.UrgencyRating * 10, _folderImages); vulnerabilityDetailsTable.AddCell(new PdfPCell(img) { Border =

Write PDF text to a PDFContext in iOS

天涯浪子 提交于 2019-12-01 08:02:28
It's pretty trivial to draw to a pdf context via: UIGraphicsBeginPDFContextToFile(pdfFile, CGRectZero, nil); UIGraphicsBeginPDFPageWithInfo(sheet.frame, nil); CGContextRef ctx = UIGraphicsGetCurrentContext(); CGRect text_rect = ... NSFont *font = ... NSString * str = @"foo"; [str drawInRect:text_rect withFont:font]; ...draw to context... However the text is clearly rasterized... Is there anyway to actually add pdf style text to a pdf file? So the user can select it, copy it, etc. Possibly through a library other than core graphics? It's definitely possible. Here's a tutorial that shows how to

Saved Text Field value is not displayed properly in PDF generated using PDFBOX

一世执手 提交于 2019-12-01 08:00:41
问题 import java.io.IOException; import javax.swing.text.BadLocationException; import org.apache.pdfbox.cos.COSArray; import org.apache.pdfbox.cos.COSDictionary; import org.apache.pdfbox.cos.COSFloat; import org.apache.pdfbox.cos.COSName; import org.apache.pdfbox.cos.COSString; import org.apache.pdfbox.exceptions.COSVisitorException; import org.apache.pdfbox.pdmodel.PDDocument; import org.apache.pdfbox.pdmodel.PDPage; import org.apache.pdfbox.pdmodel.interactive.action

Column text overflowing out of column width

落爺英雄遲暮 提交于 2019-12-01 07:52:28
问题 I am using Migradoc to generate a table and populating some dynamic data for few columns, I have defined column width while defining table structure as- Table table = new Table(); Column column = table.AddColumn(Unit.FromCentimeter(6)); column.Format.Alignment = ParagraphAlignment.Left; table.AddColumn(Unit.FromCentimeter(6)); table.AddColumn(Unit.FromCentimeter(8)); Now the third column is having data ( acs800-07-1234a-5+asdf+asdf+qwer+wert+2345+rg+2345+ag+35+qwe1252rg+34tgh+24rg+253rg+23rgh

How to generate PDF from HTML view after scripts and styles applied in ASP.NET MVC

一笑奈何 提交于 2019-12-01 07:38:01
问题 I want to generate HTML of my View to generate PDF document. It has styles and scripts applied when it opens in browser. I tried the following code but it only gives the html of view before scripts modifications. I need to get HTML of view after scripts modifications like text changed same as browser. public string RenderRazorViewToString(string viewName, object model) { ViewData.Model = model; using (var sw = new StringWriter()) { var viewResult = ViewEngines.Engines.FindPartialView