Re: PDF image import

Otfried Cheong <[email protected]>
Newsgroups gmane.comp.graphics.ipe.general
Organization Ipe HQ
Message-ID <[email protected]>

On 25/03/14 00:46, Frank Siegert wrote:
> In my case, the "pstoedit -f pdf" command simply drops part of the
> text. For example, when applied to the attached orig.pdf, this
> procedure looses the axis labels (-> new.pdf). And if I try with the
> more sophisticated "pstoedit -f gs:pdfwrite" I get a complete PDF but
> that doesn't convert properly to ipe anymore.

Attached is a patch for pdftoipe that handles the plusminus sign and 
defines an Ipe symbol "bullet" to be used for the dot symbols that 
pstricks creates in this weird way using a Symbol font.  This is 
somewhat of a hack and you probably need to play with the size of the 
symbol to get it to exactly match the pstricks version, but at least the 
file converts fine and looks correct.

Cheers,
  Otfried

_______________________________________________
Ipe-discuss mailing list
Ipe-discuss-rGrgPyRx506NN8uzcEdRPYRWq/[email protected]
http://lists.science.uu.nl/mailman/listinfo/ipe-discuss
pdftoipe.patch (text/x-patch, 1.4 KB)
diff --git a/xmloutputdev.cpp b/xmloutputdev.cpp
index 9d4ba37..757f626 100644
--- a/xmloutputdev.cpp
+++ b/xmloutputdev.cpp
@@ -79,6 +79,8 @@ XmlOutputDev::XmlOutputDev(char *fileName, XRef *xrefA, Catalog *catalog,
   writePSFmt("<layout paper=\"%g %g\" frame=\"%g %g\" origin=\"%g %g\"/>\n", 
 	     wid, ht, crop->x2 - crop->x1, crop->y2 - crop->y1, 
 	     crop->x1 - media->x1, crop->y1 - media->y1);
+  writePS("<symbol name=\"bullet\"><path matrix=\"0.04 0 0 0.04 0 0\" fill=\"black\">\n");
+  writePS("18 0 0 18 0 0 e</path></symbol>\n");
   writePS("</ipestyle>\n");
 
   // initialize sequential page number
@@ -260,7 +262,12 @@ void XmlOutputDev::drawChar(GfxState *state, double x, double y,
   startText(state, x - originX, y - originY);
 
   if (uLen == 0) {
-    writePSFmt("[S+%02x]", code);
+    if (code == 0x62) {
+      // this is a hack to handle bullets created by pstricks and should 
+      // probably be an option
+      writePS("\\ipesymbol{bullet}{}{}{}");
+    } else
+      writePSFmt("[S+%02x]", code);
   } else {
     for (int i = 0; i < uLen; ++i)
       writePSUnicode(u[i]);
@@ -436,6 +443,7 @@ struct UnicodeToLatex {
 static const UnicodeToLatex unicode2latex[] = {
   // { 0xed, "{\\'\\i}" },
   // --------------------------------------------------------------------
+  { 0xb1,  "$\\pm$" },
   { 0x391, "$\\Alpha$" },
   { 0x392, "$\\Beta$" },
   { 0x393, "$\\Gamma$" },
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.