Re: [Podofo-users] Help installing podofo
Hi Reynaldo. Podofo uses CMake to generate build files for different platforms. It means that you'll need a minimum 2.6 version installed. I don't use a MacPorts package manager on macOS, but Homebrew (https://brew.sh), so that's why I cannot give you exact commands to install dependencies. However, these steps should generally be enough to compile a basic version of Podofo: $ tar xvf ./podofo-0.9.6.tar.gz $ cd podofo-0.9.6 $ mkdir build-release $ cd build-release/ $ cmake .. $ make I'm using FreeBSD 11.2, but output of the "cmake .." command should generally be the same. You'll see something like this: -- The C compiler identification is Clang 6.0.0 -- The CXX compiler identification is Clang 6.0.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done WANT_LIB64 unset; assuming normal library directory names Will install libraries to /usr/local/lib -- Looking for strings.h -- Looking for strings.h - found -- Looking for arpa/inet.h -- Looking for arpa/inet.h - found -- Looking for winsock2.h -- Looking for winsock2.h - not found -- Looking for mem.h -- Looking for mem.h - not found -- Looking for ctype.h -- Looking for ctype.h - found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for BaseTsd.h -- Looking for BaseTsd.h - not found -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of long int -- Check size of long int - done -- Check size of int64_t -- Check size of int64_t - done -- Check if the system is big endian -- Searching 16 bit integer -- Check size of unsigned short -- Check size of unsigned short - done -- Using unsigned short -- Check if the system is big endian - little endian -- Found ZLIB: /usr/lib/libz.so Found zlib headers in /usr/include, library at /usr/lib/libz.so -- Found PkgConfig: /usr/local/bin/pkg-config (found version "1.4.2") -- Checking for module 'libcrypto' -- Package 'libcrypto', required by 'virtual:world', not found -- Found LIBCRYPTO: /usr/lib/libcrypto.so -- Performing Test PODOFO_HAVE_OPENSSL_1_1 -- Performing Test PODOFO_HAVE_OPENSSL_1_1 - Failed -- Performing Test PODOFO_HAVE_OPENSSL_NO_RC4 -- Performing Test PODOFO_HAVE_OPENSSL_NO_RC4 - Failed Found OpenSSL's libCrypto headers in /usr/include, library at /usr/lib/libcrypto.so -- Found LIBIDN: /usr/local/lib/libidn.so Found libidn headers in /usr/local/include, library at /usr/local/lib/libidn.so Libidn found. AES-256 Encryption support will be enabled -- Found LIBJPEG: /usr/local/lib/libjpeg.so Found libjpeg headers in /usr/local/include, library at /usr/local/lib/libjpeg.so -- Found TIFF: /usr/local/lib/libtiff.so Found libtiff headers in /usr/local/include, library at /usr/local/lib/libtiff.so -- Found ZLIB: /usr/lib/libz.so (found version "1.2.11") -- Found PNG: /usr/local/lib/libpng.so (found version "1.6.35+apng") Found LibPng headers in /usr/local/include;/usr/include, library at /usr/local/lib/libpng.so;/usr/lib/libz.so -- Found UNISTRING: /usr/local/include Found LibUnistring headers in /usr/local/include, library at /usr/local/lib/libunistring.so -- Found cppunit: -L/usr/local/lib -lcppunit Found cppunit. Unit tests will be built. -- Found OpenSSL: /usr/lib/libssl.so Found freetype library at /usr/local/lib/libfreetype.so, headers /usr/local/include/freetype2 -- Checking for module 'fontconfig' -- Found fontconfig, version 2.12.6 -- Found Fontconfig: fontconfig;freetype Found fontconfig headers in /usr/local/include, library at fontconfig;freetype -- Could NOT find Lua50 (missing: LUA_LIBRARIES) -- Could NOT find Lua (missing: LUA_LIBRARIES) Lua not found - PoDoFoImpose and PoDoFoColor will be built without Lua support Building multithreaded version of PoDoFo. -- Looking for pthread.h -- Looking for pthread.h - found -- Looking for pthread_create -- Looking for pthread_create - not found -- Looking for pthread_create in pthreads -- Looking for pthread_create in pthreads - not found -- Looking for pthread_create in pthread -- Looking for pthread_create in pthread - found -- Found Threads: TRUE Building static PoDoFo library -- Configuring done -- Generating done -- Build files have been written to: /home/dsl/Downloads/podofo-0.9.6/build-release Personally, I'd recommend installing libjpeg, libtiff and libpng libraries to let Podofo decode as
Re: [Podofo-users] Patch to process DecodeParms array
Hi guys. I didn't get any response and decided to remind about this patch. Do I need to change/fix it? Regards, Dmitry -- 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] Patch to process DecodeParms array
Hi guys. I've noticed that array form of "DecodeParms" entry in a stream dictionary cannot be processed even in the latest revision of PoDoFo. There is a patch attached to improve PdfFilterFactory::CreateDecodeStream a bit and assign selected dictionary from the array to a given filter according its order. Regards, Dmitry Index: podofo/trunk/src/base/PdfFilter.cpp === --- podofo/trunk/src/base/PdfFilter.cpp (revision 1933) +++ podofo/trunk/src/base/PdfFilter.cpp (working copy) @@ -338,25 +338,53 @@ } PdfOutputStream* PdfFilterFactory::CreateDecodeStream( const TVecFilters & filters, PdfOutputStream* pStream, - const PdfDictionary* pDictionary ) + const PdfDictionary* pDictionary ) { +PdfFilteredDecodeStream* pFilter; +const PdfDictionary *pdict; TVecFilters::const_reverse_iterator it = filters.rbegin(); +const PdfArray *parms_arr; +PdfArray::const_reverse_iterator parms_it; PODOFO_RAISE_LOGIC_IF( !filters.size(), "Cannot create an DecodeStream from an empty list of filters" ); -// TODO: support arrays and indirect objects here and the short name /DP -if( pDictionary && pDictionary->HasKey( "DecodeParms" ) && pDictionary->GetKey( "DecodeParms" )->IsDictionary() ) -pDictionary = &(pDictionary->GetKey( "DecodeParms" )->GetDictionary()); +pdict = pDictionary; -PdfFilteredDecodeStream* pFilter = new PdfFilteredDecodeStream( pStream, *it, false, pDictionary ); -++it; +// TODO: support indirect objects here and the short form /DP instead of /DecodeParms +parms_arr = NULL; +if ( pdict && pdict->HasKey("DecodeParms") && pdict->GetKey("DecodeParms")->IsDictionary() ) { +pdict = &(pdict->GetKey("DecodeParms")->GetDictionary()); +} else if ( pdict && pdict->HasKey("DecodeParms") && pdict->GetKey("DecodeParms")->IsArray() ) { +parms_arr = &(pdict->GetKey("DecodeParms")->GetArray()); +parms_it = parms_arr->rbegin(); +} else { +/* Keep pdict as is */; +} -while( it != filters.rend() ) -{ -pFilter = new PdfFilteredDecodeStream( pFilter, *it, true, pDictionary ); +if ( parms_arr != NULL ) { +if (parms_it->IsDictionary()) { +pFilter = new PdfFilteredDecodeStream( +pStream, *it, false, &(parms_it->GetDictionary())); +} else { +pFilter = new PdfFilteredDecodeStream(pStream, *it, false, pdict); +} ++it; +++parms_it; +} else { +pFilter = new PdfFilteredDecodeStream(pStream, *it, false, pdict); +++it; } +while ( it != filters.rend() ) { +if ( (parms_arr != NULL) && (parms_it != parms_arr->rend()) && parms_it->IsDictionary() ) { +pFilter = new PdfFilteredDecodeStream( +pFilter, *it, true, &(parms_it->GetDictionary())); +} else { +pFilter = new PdfFilteredDecodeStream(pFilter, *it, true, pdict); +} +++it; +++parms_it; +} return pFilter; } -- 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] Windows build on Podofo 0.9.5
Hello, Patrice. Your configuration seems a bit complicated to me. Why not to specify all of the required paths using CMake GUI and generate a VS project? Regards, Dmitry -- 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] extract tiff from scanned pdf
Hi Martin, podofo mailing list doesn't look like an active place from my pov. If you're going to decode buffer using CCITT decoder, I've bad news for you. There is only a draft implementation of PdfCCITTFilter in PdfFiltersPrivate.cpp. You may notice that method to decode block isn't implemented at all: void PdfCCITTFilter::DecodeBlockImpl( const char*, pdf_long ) { } I've a decoder implemented (using libtiff), but it's a part of proprietary product and I'm just trying to persuade my team to prepare a patch and donate code to the library. Everyone would benefit in this case. I think I'll be able to share it in several weeks only. P.S. I've podofo 0.9.5 sources, so my information can be outdated. Regards, - Dmitry -- 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] Fwd: Testing email flow through sourceforge...
I've got these two. It probably works at the moment. Regards, - Dmitry -- 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] Accessing the images of one page?
Hi Matthew, Olivier, I agree about XObjects, but it's not so hard to deal with inline ones using tokenizer class. I already have it implemented for both types of images, but don't have enough time to prepare a good snippet. Give me several days and it'll be here :) Regards, - Dmitry -- 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] Accessing the images of one page?
Olivier, ah, I see. Anyway, your idea is to get any PDF file, scan it page by page and perform an action if there is a specific image (QR code) placed on any page. Am I correct? Regards, - Dmitry -- 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] Accessing the images of one page?
Hi, Olivier. (this is a copy of my previous reply which, for some reason, wasn't posted on the mailing list yesterday O_o) First of all, you've to know what kind of image you're going to access. They usually can be stored in a PDF file two ways: XObject image or inline one. Does it make any sense? Regards, - Dmitry Regards, - Dmitry On Tue, Feb 20, 2018 at 5:26 PM, Olivier Masciawrote: > Dear all, > > The podofoimgextract tool is a good documentation on how to access all > images in a PDF file. > What I would like to do is access all the images used on one page. > I'm a bit short on documentation or sample code to get inspiration, short > of reading the Adobe PDF standard, I suppose. :) > > To understand the context, the purpose is to scan for QR barcodes on each > page and act on that page when found. The QR side is not an issue. I'm just > hardly finding my way on how to properly enumerate the images used on a > page instead of browsing all the images as a whole without consideration on > which page it is used. It probably is incredibly simple to do using the > primitives of PoDoFo, but I'm still struggling learning it deeper than at > its surface. > > If you know of a bit of code or merely a bit of documentation which might > be useful for me to read, I'm all ears. > > Thanks a lot, > -- > Best Regards, Meilleures salutations, Met vriendelijke groeten, > Olivier Mascia > > > > > -- > 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] Difference between PdfObject::GetReference() and PdfObject::Reference()
Georg, no problem (: It's nice that this code helped. Regards, - Dmitry -- 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] Difference between PdfObject::GetReference() and PdfObject::Reference()
Hi, Georg. I'm not a developer of PoDoFo and don't know any details lying deep there. You may just take a look at the src/base/PdfObject.h and src/base/PdfVariant.h to understand the difference between these two functions: inline const PdfReference & Reference() const; inline const PdfReference & GetReference() const; and their implementations: const PdfReference & PdfObject::Reference() const { return m_reference; } const PdfReference & PdfVariant::GetReference() const { DelayedLoad(); if( !IsReference() ) { PODOFO_RAISE_ERROR( ePdfError_InvalidDataType ); } // Do not change this to an reinterpret_cast // We need a c-style casts here to avoid crashes // because a reinterpret_cast might point to a different position. return *((PdfReference*)m_Data.pData); } Personally, I didn't have a need to find object by its object and generation numbers, but I had to obtain 'em from an existing one. There is a chance that this piece of code to get a specific XObject by its name will be useful: PdfObject *xobj; int nobj, ngen; xobj = get_xobject(_name, (PdfCanvas *)page); /* Is object a reference? */ if (xobj->IsReference()) xobj = doc->GetObjects().GetObject(xobj->GetReference()); ngen = xobj->Reference().GenerationNumber(); nobj = xobj->Reference().ObjectNumber(); /* ... */ static PdfObject *get_xobject(PdfName *xobjname, PdfCanvas *pPage) { PdfObject *pResources = pPage->GetResources(); PdfObject *xobj_dict; if (pResources != NULL && pResources->GetDictionary().HasKey(PdfName("XObject"))) { xobj_dict = pResources->GetIndirectKey(PdfName("XObject")); if (xobj_dict != NULL && xobj_dict->IsDictionary()) { return xobj_dict->GetIndirectKey(*xobjname); } } return NULL; } Regards, - Dmitry On Fri, Jan 12, 2018 at 10:35 PM, Georg Funkwrote: > Dear podofo-developers, > > could you please describe the difference between PdfObject::GetReference() > and PdfObject::Reference()? > I need a way to access PdfObjects from within a PfVecObjects vector by > their object and generation number. Further I need a function to follow > indirect references of an object. > Can I use the above mentioned methods for these purposes? > > Thank you in advance! > > Regards, > Georg > > -- > 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] Github instead of SourceForge
Hi, Lack of time, probably. I'd prefer to see a roadmap of PoDoFo instead of tinkering with version control systems. Regards, - Dmitry -- 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] Viewing encrypted PDFs produces error
Hi, Alex. You're probably getting this error because of incorrect PDF files. You may check it there: https://www.pdf-online.com/osa/validate.aspx (I wasn't able to download your PDF files from that hosting for some reason). It's also probably a good idea to retrieve the latest 0.9.5 version of PoDoFo, compile "podofopdfinfo" with debug symbols and run it under lldb or gdb. Do not forget to place a breakpoint on a line where you're getting this error from before running the program. When it stops, you'll be able to get a callstack and guess what went wrong (or just post it here for further investigation). About the first question, it seems that "podofopdfinfo" tried to convert a variable of common (variant) type into something specific and had no luck. -- 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] Incorrect character displacement
Hi, I'm using PoDoFo to extract character displacement to update a text matrix correctly. This is a code fragment of mine: PdfString str, ucode_str; std::stack *stack;const PdfFontMetrics *f_metrics;... /* Convert string to UTF8 */ str = stack->top().GetString(); ucode_str = ts->font->GetEncoding()->ConvertToUnicode(str, ts->font);stack->pop(); c_str = (char *) ucode_str.GetStringUtf8().c_str(); /* Font metrics to obtain a character displacement */ f_metrics = ts->font->GetFontMetrics(); for (j = 0; j < strlen(c_str); j++) { str_w = f_metrics->CharWidth(c_str[j]); /* Adjust text matrix using str_w */ ...} It works well for some PDF files (str_w contains a useful width), but doesn't work for others. In these cases str_w contains 0.0. I took a look at the PoDoFo 0.9.5 sources and found CharWidth() implemented for all sub-classes of PdfFontMetrics. Am I missing something important during this string conversion? -- Kind regards, Dmitry Salychev darkness@gmail.com -- 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