Skip to content

Instantly share code, notes, and snippets.

@mtyaka
Last active December 20, 2015 21:19
Show Gist options
  • Save mtyaka/6196945 to your computer and use it in GitHub Desktop.
Save mtyaka/6196945 to your computer and use it in GitHub Desktop.
Patches poppler's pdftocairo to be able to write result to stdout. Tested with pdftocairo 0.22.5.
diff --git a/utils/pdftocairo.cc b/utils/pdftocairo.cc
index 192d295..2c4e05a 100644
--- a/utils/pdftocairo.cc
+++ b/utils/pdftocairo.cc
@@ -664,6 +664,9 @@ static GooString *getImageFileName(GooString *outputFileName, int numDigits, int
{
char buf[10];
GooString *imageName = new GooString(outputFileName);
+ if (imageName->cmp("fd://0") == 0) { // stdout
+ return imageName;
+ }
if (!singleFile) {
snprintf(buf, sizeof(buf), "-%0*d", numDigits, page);
imageName->appendf(buf);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment