[Podofo-users] PdfImage + annotations quality
A PDF parsing, modification and creation library.
Brought to you by:
domseichter
|
From: Ismael S. <is...@gm...> - 2012-11-12 18:24:28
|
Greetings!
I've been struggling with the problem of drawing japanese/arabic/etc glyphs in an annotation's stream, and the closest i've gotten is drawing the text into an image and then drawing the image into the stream
here's the code I use:
NSData *data = UIImagePNGRepresentation(scaledImage);
NSString *tempPath = [NSTemporaryDirectory() stringByAppendingPathComponent:@"podofoimage.png"];
[data writeToFile:tempPath atomically:YES];
PdfPainter painter;
PdfImage image(document);
PdfRect rect(0, 0, width, height);
PdfXObject xObj(rect, document);
image.LoadFromFile(tempPath.UTF8String);
painter.SetPage(&xObj);
painter.SetClipRect(rect);
painter.DrawImage(0.0, 0.0, &image);
painter.FinishPage();
I've attached the resulting .png image ("podofoimage.png"), how the pdf should look ("expected.png"), and how it actually looks ("result.png").
The "result.png" has 2 different examples:
The top one is using png
The bottom one is using jpg with white background and a white chroma key mask (set right after the image.LoadFromFile()) - notice the random white dots around
image.SetImageChromaKeyMask(255, 255, 255);
Any idea why there's such bad quality in the output? I don't need it to be vectorized or extremely HD, but this quality is extremely low and doesn't quite cut my needs
To improve the "podofoimage.png" quality i've also tried to draw it into a larger image (say x2.0 scale) but then the annotation is empty, no idea why either
|