PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Fri Feb 28, 2020 2:08 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Wed May 28, 2008 4:17 pm 
Offline

Joined: Wed May 28, 2008 4:05 pm
Posts: 2
I have PDF file, i tried to append some text to it using program from samples. (Unicode) After it worked there are errors in document (fonts are embedded with errors, and there are only dots instead of text)

Here are steps to reproduce:
1) Get this file http://www.uploading.com/files/KTG63HP6/form2.pdf.html
2) Open Unicode program from Samples C# folder (or use code below)
3) Change lines so that:
// Create new document
PdfDocument document = PdfReader.Open(@"c:\form2.pdf");
(here comes your path to file)
4) scroll down till you see pages that were added by code and see the result (and acrobat's error)

Code to test:

class Program
{
[STAThread]
static void Main(string[] args)
{
// Create new document
PdfDocument document = PdfReader.Open(@"c:\form2.pdf");

// Set unicode flag to true
XPdfFontOptions options = new XPdfFontOptions(PdfFontEncoding.Unicode,PdfFontEmbedding.Always);

XFont font = new XFont("Times New Roman", 12, XFontStyle.Regular, options);

// Draw text in different languages
for (int idx = 0; idx < texts.Length; idx++)
{
PdfPage page = document.AddPage();
XGraphics gfx = XGraphics.FromPdfPage(page);
XTextFormatter tf = new XTextFormatter(gfx);
tf.Alignment = XParagraphAlignment.Justify;

tf.DrawString(texts[idx], font, XBrushes.Black,
new XRect(100, 100, page.Width - 200, 600), XStringFormat.TopLeft);
}

string filename = "Unicode.pdf";
// Save the document...
document.Save(filename);
// ...and start a viewer.
Process.Start(filename);
}

static string[] texts = new string[]
{
// International version of the text in English
"English\n" +
"PDFsharp is a .NET library for creating and processing PDF documents 'on the fly'. " +
"The library is completely written in C# and based exclusively on safe, managed code. ",

// PDFsharp is 'Made in Germany'
"German\n" +
"PDFsharp ist eine .NET-Bibliothek zum Erzeugen und Verarbeiten von PDF-Dokumenten 'On the Fly'. " +
"Die Bibliothek ist vollst├Ąndig in C# geschrieben und basiert ausschlie├člich auf sicherem, verwaltetem Code. ",

// Greek version
// The text was translated by Babel Fish. We here in Germany have no idea what it means.
// If you are a native speaker please correct it and mail it to mailto:PDFsharpSupport@pdfsharp.de
"Greek (Translated with Babel Fish)\n" +
"Το PDFsharp είναι βιβλιοθήκη δικτύου α. για τη δημιουργία και την επεξεργασία των εγγράφων PDF 'σχετικά με τη μύγα'. Η βιβλιοθήκη γράφεται εντελώς γ # και βασίζεται αποκλειστικά εκτός από, διοικούμενος κώδικας. Το PDFsharp προσφέρει δύο ισχυρά επίπεδα αφαίρεσης για να δημιουργήσει και να επεξεργαστεί",

// Russian version (by courtesy of Alexey Kuznetsov)
"Russia\n" +
"PDFsharp это .NET библиотека для создания и обработки PDF документов 'налету'. " +
"Библиотека полностью написана на языке C# и базируется исключительно на безопасном, управляемом коде. " +
"PDFsharp использует два мощных абстрактных уровня для создания и обработки PDF документов.\n" +
"Для рисования текста, графики, и изображений в ней используется набор классов, которые разработаны аналогично с",

// Your language may come here
"Invitation\n" +
"If you use PDFsharp and haven't found your native language in this document, we will be pleased to get your translation of the text above and include it here.\n" +
"Mail to PDFsharpSupport@pdfsharp.de"
};


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Wed Jun 04, 2008 8:22 am 
Offline
PDFsharp Guru
User avatar

Joined: Mon Oct 16, 2006 8:16 am
Posts: 3027
Location: Cologne, Germany
We cannot replicate this problem with current builds of PDFsharp.

A new version of PDFsharp will be publicly available during summer 2008.

_________________
Regards
Thomas Hoevel
PDFsharp Team


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Mon Jun 16, 2008 9:29 pm 
Offline

Joined: Wed May 28, 2008 4:05 pm
Posts: 2
Strange, I could reproduce it on different computers. Still thank you very much for your reply, I will be waiting for new version!


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users and 13 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Privacy Policy, Data Protection Declaration, Impressum
Powered by phpBB® Forum Software © phpBB Group