Re: [Podofo-users] MRC compression support
Hello all, > zamazan4ikhas written on 19 November 2017 at 02:37: > > > Thank you for the brief explanation and for the very useful links. > > I am not so familiar with PoDoFo. But... is it possible to do something > similar things as pdfbeams do: create PDF page from set of images > (background + foreground + text mask)? > as an aside: it isn't pdfbeams, but pdfbeads which I found (after installing the development package for Ruby, on Ubuntu ruby-dev, "gem install pdfbeads" without quotes should work). On to PoDoFo: After constructing a PdfImage (e.g. from a PdfDocument), use GetObject() to get its PdfObject, then GetDictionary().AddKey(PdfName::KeyFilter, filtName) on that, where filtName is the name of the PDF filter which is suitable for the image data, e.g. "JBIG2Decode" for JBIG2-encoded bi-level (b) image data or "DCTDecode" for header-less JPEG image data. As the former is not directly supported by PoDoFo, it is necessary to load the image data using the method PdfImage::SetImageDataRaw() so that PoDoFo doesn't try to apply a filter. Don't call GetFilteredCopy() on the resulting stream then, not even indirectly as for JBIG2Decode, CCITTFaxDecode and JPXDecode that won't work. (RunLengthDecode also is untested, maybe it also doesn't work.) You can then use the PdfImage with the PdfPainter::DrawImage() method (even though the documentation mentions a PdfXObject, pass PdfImage pointers only). Best regards, mabri > > 18.11.2017 14:47, Matthew Brincke пишет: > > Hello all, > > > >> zamazan4ik has written on 18 November 2017 at 00:18: > >> > >> Hello, > >> > >> Has PoDoFo library support for MRC compression? Are there segmentator in > >> the library? Or maybe are there some stuff for writing different layers > >> with different compression algorithms? > >> > > the PoDoFo library does not support any segmentation of images (at least > > yet), so no, it does not have MRC support. > > What is available is that you can have PoDoFo change compression filters > > on a per-PdfObject basis (however you need to have enough RAM for storing > > the uncompressed stream). Please note that CCITTFax (de)compression is not > > implemented yet. > > > > I don't know if it's appropriate to write here (sorry), but I've found an > > (reportedly) open-source solution for MRC compression: pdfbeads, a Ruby gem. > > See this forum thread: https://forum.diybookscanner.org/viewtopic.php?t=987 > > (title: MRC compression + text under images - DIY Book Scanner) > > For further info, look in the Wikipedia article on "Mixed Raster Content". > > Also I found this > > https://engineering.purdue.edu/~bouman/software/Text-Seg/tip30.pdf > > (title: Text Segmentation for MRC Document Compression) > > > >> Thank you. > >> > > Best regards, mabri > > -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users
Re: [Podofo-users] MRC compression support
Thank you for the brief explanation and for the very useful links. I am not so familiar with PoDoFo. But... is it possible to do something similar things as pdfbeams do: create PDF page from set of images (background + foreground + text mask)? 18.11.2017 14:47, Matthew Brincke пишет: Hello all, zamazan4ik has written on 18 November 2017 at 00:18: Hello, Has PoDoFo library support for MRC compression? Are there segmentator in the library? Or maybe are there some stuff for writing different layers with different compression algorithms? the PoDoFo library does not support any segmentation of images (at least yet), so no, it does not have MRC support. What is available is that you can have PoDoFo change compression filters on a per-PdfObject basis (however you need to have enough RAM for storing the uncompressed stream). Please note that CCITTFax (de)compression is not implemented yet. I don't know if it's appropriate to write here (sorry), but I've found an (reportedly) open-source solution for MRC compression: pdfbeads, a Ruby gem. See this forum thread: https://forum.diybookscanner.org/viewtopic.php?t=987 (title: MRC compression + text under images - DIY Book Scanner) For further info, look in the Wikipedia article on "Mixed Raster Content". Also I found this https://engineering.purdue.edu/~bouman/software/Text-Seg/tip30.pdf (title: Text Segmentation for MRC Document Compression) Thank you. Best regards, mabri -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users
Re: [Podofo-users] MRC compression support
Hello all, > zamazan4ik has written on 18 November 2017 at 00:18: > > Hello, > > Has PoDoFo library support for MRC compression? Are there segmentator in > the library? Or maybe are there some stuff for writing different layers > with different compression algorithms? > the PoDoFo library does not support any segmentation of images (at least yet), so no, it does not have MRC support. What is available is that you can have PoDoFo change compression filters on a per-PdfObject basis (however you need to have enough RAM for storing the uncompressed stream). Please note that CCITTFax (de)compression is not implemented yet. I don't know if it's appropriate to write here (sorry), but I've found an (reportedly) open-source solution for MRC compression: pdfbeads, a Ruby gem. See this forum thread: https://forum.diybookscanner.org/viewtopic.php?t=987 (title: MRC compression + text under images - DIY Book Scanner) For further info, look in the Wikipedia article on "Mixed Raster Content". Also I found this https://engineering.purdue.edu/~bouman/software/Text-Seg/tip30.pdf (title: Text Segmentation for MRC Document Compression) > Thank you. > Best regards, mabri -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users
[Podofo-users] MRC compression support
Hello, Has PoDoFo library support for MRC compression? Are there segmentator in the library? Or maybe are there some stuff for writing different layers with different compression algorithms? Thank you. -- Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot ___ Podofo-users mailing list Podofo-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/podofo-users