Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt to pre-21.12 Poppler #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions pdf2printable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,23 @@ int pdf_to_printable(std::string inFile, WriteFun writeFun, const PrintParameter
Pointer<PopplerDocument> doc(nullptr, g_object_unref);
GError* error = nullptr;

#if POPPLER_CHECK_VERSION(21, 12, 0)
if(inFile == "-")
{
doc = poppler_document_new_from_fd(STDIN_FILENO, nullptr, &error);
}
#else
Bytestream inBts;
if(inFile == "-")
{
inBts = Bytestream(std::cin);
// Safe until 21.12 at least, ignore deprecation.
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
doc = poppler_document_new_from_data((char*)inBts.raw(), inBts.size(), nullptr, &error);
#pragma GCC diagnostic pop
}
#endif
else
{
if (!g_path_is_absolute(inFile.c_str()))
Expand Down