|
|
German Umlaut + Stamp position problems
Last post 05-20-2008, 2:03 AM by AdeelTaseer. 8 replies.
-
03-19-2008, 7:57 AM |
-
Stefan Falz
-
-
-
Joined on 02-14-2008
-
-
Posts 14
-
-
-
-
Issues: PDFKITNET-4634
|
German Umlaut + Stamp position problems
Attachment: Present (inaccessible)
Hi,
i'm working with the last Pdf.Kit version (3.0) and need to put some text stamps on existing pdf documents.
In the most cases all is fine. But with several documents there are a few problems.
First problem is that the position of the stamp is not correct in some documents. Attached you find four documents (Test1.pdf, Test2.pdf are the original files, Test1_s.pdf, Test2_s.pdf are stamped). The position should be 15, 15 (bottom, left) but is 15, -xy?
Second problem has to do with German Umlauts (ä, ö, ü). Due to the fact that none of the integrated fonts (Aspose.Pdf.Kit.FontStyle...) supports German Umlauts i'm binding another font (i.e. "C:\Windows\fonts\ARIALUNI.TTF" or "C:\Windows\fonts\Verdana.ttf"). But as you can see in Test3_s.pdf (Original file is Test3.pdf) opening the file in Acrobat Reader results in an error message like "Could not find font ...". (I don't know the exact english message because i'm working in a german environment) and instead of the stamp text there are only some dots!?
Following the code used to generate the stamped files.
Dim MyStamp As New Aspose.Pdf.Kit.Stamp() MyStamp.BindLogo( New FormattedText( "Test mit Umlaut äöü?", Color.Red, "C:\Windows\fonts\ARIALUNI.TTF", EncodingType.Cp1252, False, 12 ) ) 'MyStamp.BindLogo( New FormattedText( "Test mit Umlaut äöü?", Color.Red, Aspose.Pdf.Kit.FontStyle.Helvetica, EncodingType.Winansi, False, 12 ) ) MyStamp.Rotation = 0 MyStamp.SetOrigin( 15, 15 )
Dim PdfStamper As New Aspose.Pdf.Kit.PdfFileStamp() PdfStamper.InputFile = "X:\Folder\Test1.pdf" PdfStamper.OutputFile = "X:\Folder\Test1_s.pdf" PdfStamper.AddStamp( MyStamp ) PdfStamper.Close()
The attached files are only samples showing the errors described above.
Thank you in advance, Stefan
|
|
-
03-19-2008, 1:03 PM |
-
AdeelTaseer
-
-
-
Joined on 12-15-2006
-
-
Posts 2,437
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi,
I have test this and was able to reproduce the error. I have logged this as PDFKITNET-4634 in our issue tracking system. We will try our best to resolve this as soon as possible.
Thanks.
|
|
-
05-08-2008, 4:50 AM |
-
Stefan Falz
-
-
-
Joined on 02-14-2008
-
-
Posts 14
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi,
any news on this? 2 months should be time enough to fix this bug!?
Best Regards, Stefan
|
|
-
05-08-2008, 7:27 AM |
-
Felix.Liu
-
-
-
Joined on 10-10-2007
-
-
Posts 218
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi,
The first problem have been resolved and the fix will be included in the coming release( which will be published before next weekend, so I'm ready to inform you on that time :-) ).
The second problem is caused by the compatibilities of different PDF versions. And we find that the PDF v1.2 files (using before Adobe Reader 3.0) could not support it well for stamping with TrueType-font. I should say that the problem is hardly to be resolved directly.
Thanks,
Felix Liu Developer Aspose Changsha Team About Us Contact Us
|
|
-
05-09-2008, 1:47 AM |
-
Stefan Falz
-
-
-
Joined on 02-14-2008
-
-
Posts 14
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi Felix,
thank you for yor fast response. So is there any way to retrieve the pdf-version of a specific file? If yes, i 'm able to take some action when stamping "old" files.
I thought Aspose.Pdf.Kit.PdfFileInfo could be used for this but i can't find any property or method that returns the pdf-version. If the method GetMetaInfo is the right one, which name i must provide to this method?
Best regards, Stefan
|
|
-
05-09-2008, 3:55 AM |
-
Felix.Liu
-
-
-
Joined on 10-10-2007
-
-
Posts 218
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi Stefan,
You will find such a method in our new versions.
Thanks,
Felix Liu Developer Aspose Changsha Team About Us Contact Us
|
|
-
05-16-2008, 3:46 AM |
-
Felix.Liu
-
-
-
Joined on 10-10-2007
-
-
Posts 218
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi Stefan,
New version published, please download and try it.
Thanks,
Felix Liu Developer Aspose Changsha Team About Us Contact Us
|
|
-
05-19-2008, 1:37 AM |
-
Stefan Falz
-
-
-
Joined on 02-14-2008
-
-
Posts 14
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi Felix,
it seems like the position problems are gone away. PdfFileInfo.GetPdfVersion() returns the version so i'm able to insert a workaround for pdf's prior to v1.3. Find the used code below (perhaps someone come across the same problem).
' --- Check file type Dim PdfKitFileInfo As New PdfFileInfo( SourcePath ) If Not PdfKitFileInfo.BePdfFile() Then Throw New PdfException( "The requested file ist not a valid pdf file." ) End If
' --- Get pdf version. Dim PdfVersion As Double Try Double.TryParse( PdfKitFileInfo.GetPdfVersion().Replace( ".", "," ), PdfVersion ) Catch ex As Exception PdfVersion = 1.0 End Try
' --- Create stamp object Dim PdfKitStamp As New Aspose.Pdf.Kit.Stamp() ' --- PDFs prior v1.3 cannot contain stamps with Umlauts, so we need ' --- to encode the Umlauts and use an internal font before adding the ' --- stamp to the pdf file. If PdfVersion < 1.3 Then PdfKitStamp.BindLogo( New FormattedText( EncodeSpecialChars( Stamp ), Color.Red, Aspose.Pdf.Kit.FontStyle.Helvetica, EncodingType.Winansi, True, 12 ) ) Else PdfKitStamp.BindLogo( New FormattedText( Stamp, Color.Red, HttpContext.Current.Server.MapPath( "~/Resources/Verdana.ttf" ), EncodingType.Winansi, True, 12 ) ) End If
...
Public Function EncodeSpecialChars( ByVal Text As String ) As String
Dim Result As String Result = Text Result = Result.Replace( "ä", "ae" ) Result = Result.Replace( "ö", "oe" ) Result = Result.Replace( "ü", "ue" ) Result = Result.Replace( "ß", "ss" ) Result = Result.Replace( "Ä", "Ae" ) Result = Result.Replace( "Ö", "Oe" ) Result = Result.Replace( "Ü", "Ue" )
Return Result
End Function
Best Regards, Stefan
|
|
-
05-20-2008, 2:03 AM |
-
AdeelTaseer
-
-
-
Joined on 12-15-2006
-
-
Posts 2,437
-
-
-
-
|
Re: German Umlaut + Stamp position problems
Hi,
Thank you for sharing this with us. It is much appreciated.
|
|
|
|