PDFsharp & MigraDoc Foundation

PDFsharp - A .NET library for processing PDF & MigraDoc Foundation - Creating documents on the fly
It is currently Thu Jul 11, 2024 2:19 pm

All times are UTC


Forum rules


Please read this before posting on this forum: Forum Rules



Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Fri Nov 24, 2006 3:50 am 
Offline

Joined: Fri Nov 24, 2006 3:26 am
Posts: 1
Using sample XGraphicsLab.exe,
1. in "XGraphics Properties" window, set "Font Family" some traditional chinese font builtin in my PC. Type some chinese characters in the bottom TextBox.
2. in "XGraphics Lab" window, select [Text>Layout 1], the traditional chinese characters which I type in "XGraphics Properties" window do appear correctly in "Preview" window.
3. When I click the [Create PDF] button in "Preview" window , "Assert failed" dialog show up, after press [Ignore] button many times, Acrobat Reader load the pdf file I just created, BUT all chinese characters appear as a '?'

What is the problem ? :?


Top
 Profile  
Reply with quote  
PostPosted: Fri May 13, 2011 4:20 am 
Offline

Joined: Fri May 13, 2011 3:32 am
Posts: 4
Dear all

I use PDFSharp Create Traditional Chinese PDF File
Will always appear as multiple error messages , Has been ignored Button Many times , Until after you complete the program
Use Adobe Reader Open PDF File , Traditional Chinese Fonts Normally appear
But I do not know in the process of creating , How to troubleshoot the error messages that appear


Attachments:
Error Message Image.jpg
Error Message Image.jpg [ 230.11 KiB | Viewed 11307 times ]
Create OK PDF File.jpg
Create OK PDF File.jpg [ 47.35 KiB | Viewed 11307 times ]
Top
 Profile  
Reply with quote  
PostPosted: Fri May 13, 2011 8:57 pm 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 343
scneter wrote:
How to troubleshoot the error messages that appear

Looks like a Debug.Assert message that won't come with a Release build.

If you let us know which Asserts are triggered I can try to find out what it means.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Sat May 14, 2011 5:29 am 
Offline

Joined: Fri May 13, 2011 3:32 am
Posts: 4
Dear All
I Try Sample Code & Add Test Code For Unicode
Use Code Like this:
'------------ Use ImageToPDF Demo Sample Code (VB2008) -----------------------------
Imports System.IO
Imports PdfSharp
Imports PdfSharp.Pdf
Imports PdfSharp.Drawing

Public Class Form1
Private Sub B1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles B1.Click
Dim document As PdfDocument = New PdfDocument
document.Info.Title = "Created with PDFsharp"
Dim source As String = CurDir() & "\20110429143219_2.jpg"
Dim img As XImage = XImage.FromFile(source)
' Create an empty page
Dim page As PdfPage = document.AddPage
' Get an XGraphics object for drawing
Dim gfx As XGraphics = XGraphics.FromPdfPage(page)
gfx.DrawImage(img, 100, 100, 160, 120)
gfx.DrawImage(img, 300, 100, 160, 120)
' Draw crossing lines
Dim pen As XPen = New XPen(XColor.FromArgb(255, 0, 0))
'gfx.DrawMatrixCode(pen, New XPoint(20, 100))
gfx.DrawRectangle(pen, New XRect(100, 200, 400, 150))
' Draw an ellipse
gfx.DrawEllipse(pen, 3 * page.Width.Point / 10, 3 * page.Height.Point / 10, 2 * page.Width.Point / 5, 2 * page.Height.Point / 5)
' Create a font
Dim options As New XPdfFontOptions(PdfFontEncoding.Unicode, PdfFontEmbedding.Always)
Dim font As XFont = New XFont("標楷體", 20, XFontStyle.Bold, options)
'Dim font As XFont = New XFont("Times New Roma", 20, XFontStyle.Bold)
' Draw the text
gfx.DrawString("Hello, World!", font, XBrushes.Black, New XRect(0, 0, page.Width.Point, page.Height.Point), XStringFormat.Center)
'---------------------- Test UniCode -------------------------------
gfx.DrawLine(pen, New XPoint(0, 0), New XPoint(page.Width.Point, page.Height.Point))
gfx.DrawLine(pen, New XPoint(page.Width.Point, 0), New XPoint(0, page.Height.Point))
gfx.DrawString("世界你好!", font, XBrushes.Black, New XRect(0, 50, page.Width.Point, page.Height.Point), XStringFormat.Center)
gfx.DrawString("這是測試 PDF 圖片檔案", font, XBrushes.Black, 150, 230)
gfx.DrawString("這是測試 PDF 圖片檔案", font, XBrushes.Black, 160, 260)
gfx.DrawString("這是測試 PDF 圖片檔案", font, XBrushes.Black, 170, 290)
gfx.DrawString("這是測試 PDF 圖片檔案", font, XBrushes.Black, 180, 320)
'----------------------------------------------------------------------
' Save the document...
Dim filename As String = "HelloWorld.pdf"
document.Save(filename)
' ...and start a viewer.
Process.Start(filename)
End Sub
End Class


Top
 Profile  
Reply with quote  
PostPosted: Sat May 14, 2011 9:07 am 
Offline
PDFsharp Expert
User avatar

Joined: Wed Dec 09, 2009 8:59 am
Posts: 343
scneter wrote:
Use Code Like this

Sorry, mate, but I won't use that code. I don't have chinese Windows, I don't have chinese Fonts, so probably I won't get the Debug.Assert anyway ...

I asked where in the PDFsharp code is the Debug.Assert that shows the messages you get. When the message comes, click Debug and you should see the line of code in your debugger.
Filename, methodname and linenumber will do.

_________________
Öhmesh Volta ("() => true")
PDFsharp Team Holiday Substitute


Top
 Profile  
Reply with quote  
PostPosted: Mon May 16, 2011 1:40 am 
Offline

Joined: Fri May 13, 2011 3:32 am
Posts: 4
Sorry!
Sorry! because my English is not good
It may be, can not fully understand what you're saying
But I will try to understand what you're saying, and try to put your way to complete the work of debugging

I'm back online to download new PDFSharp.DLL, after re-compile the test, they can already be displayed
But when I change the font in different font other tests and found he could not find the font error occurs

1. Appears before the problem is when I carried PDFsharp.Save (nFileName) problems arising
2. Now with the new DLL files, fonts when loading
Dim font As XFont = New XFont (FontNameString, 20, XFontStyle.Bold, options) was a problem

scneter chang


Top
 Profile  
Reply with quote  
PostPosted: Tue May 17, 2011 2:29 am 
Offline

Joined: Fri May 13, 2011 3:32 am
Posts: 4
Dear All

I tested other fonts, and some can be normal, there is an error
I do not know where the problem because there is obviously a font
It generates an error message the program caused an interrupt, can not perform

I will continue to find time to continue testing to see if there is no solution

Thank you!

scneter chang


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

All times are UTC


Who is online

Users browsing this forum: Bing [Bot] and 70 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