如何插入透明PNG PDF格式? [英] How to insert transparent PNG in PDF?

查看:1358
本文介绍了如何插入透明PNG PDF格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以插入JPG图像与 DCTDe code 过滤器的PDF文档。我认为,所有参数应该是相同的 PNG 图像太,除了过滤器应 FlateDe code 。然而,当我尝试插入 PNG 用同样的参数,PNG图像是不是他在PDF文档中可见。

I am able to insert JPG image into a PDF document with DCTDecode filter. I think the all parameters should be the same for PNG image too, except the filter which should be FlateDecode. However, when I try to insert PNG with the same parameters, the PNG image is not visible in he PDF document.

更新:我来的结论,即PDF文件应包括

UPDATE: I came to conclusion that the PDF file should include

1 0 obj <<
/Type /XObject
/Subtype /Image
/Width 512
/Height 512
/BitsPerComponent 8
/ColorSpace /DeviceRGB
/SMask 9 0 R
/Length 134753    
/Filter /FlateDecode
>>
stream
PNG_RAW DATA
endstream
endobj
9 0 obj <<
/Type /XObject
/Subtype /Image
/Width 512
/Height 512
/BitsPerComponent 8
/ColorSpace /DeviceGray
/Length 12087     
/Filter /FlateDecode
>>
stream
ALPHA_PIXELS
endstream
endobj

但我怎么能分出 PNG 原始数据和阿尔法像素通过的ImageMagick ?换句话说,是什么 ImageMagick的命令可以产生 PDF_RAW_DATA ALPHA_PIXELS 插入到PDF文件中。

BUT how can I separate the PNG raw data and the alpha pixels via ImageMagick? In other words, what ImageMagick command can produce PDF_RAW_DATA and ALPHA_PIXELS for insertion into the pdf file.

推荐答案

最可能的是你没有çPNG图像去$ C $。

Most probably you didn't decode PNG images.

PNG格式不直接在PDF的支持。我的意思是,他们不支持JPEG格式的方式支持。

PNGs are not directly supported in PDF. I mean they are not supported in way JPEGs are supported.

您必须将它们嵌入到PDF之前生产原料uncom pressed光栅字节的PNG图像。您可以连接code光栅字节使用Flate或LZW EN codeR如果你想。

You have to produce raw uncompressed raster bytes from PNGs before embedding them into PDF. You may encode the raster bytes with Flate or LZW encoder if you wish.

这篇关于如何插入透明PNG PDF格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆