View Single Post
Old 12-23-2009, 05:28 AM   #37
ahsin_111
Junior Member
ahsin_111 began at the beginning.
 
Posts: 2
Karma: 10
Join Date: Dec 2009
Device: none
Not able to remove watermark [:(]

Quote:
Originally Posted by Jellby View Post
I've tried Prince XML and it's quite easy and powerful, at least at first sight. As a test, I've done the conversion of The Picture of Dorian Gray, and the result is attached.

All that was needed was this user css:

pdf_output.css
Code:
@page {
  size: 9cm 12cm;
  margin: 5mm 1mm 1mm 1mm;
  @top-left {
    border-bottom: solid 0.2pt #000;
    margin-bottom: 1mm;
    content: "";
  }
  @top-center {
    font-size: 60%;
    font-style: italic;
    border-bottom: solid 0.2pt #000;
    margin-bottom: 1mm;
    content: string(chaptitle);
  }
  @top-right {
    font-size: 50%;
    border-bottom: solid 0.2pt #000;
    margin-bottom: 1mm;
    content: counter(page) "/" counter(pages);
  }
}

@page:first {
  margin: 1mm 1mm 1mm 1mm;
  @top-left {
    border-size: 0;
    margin: 0;
    content: normal;
  }
  @top-center {
    border-size: 0;
    margin: 0;
    content: normal;
  }
  @top-right {
    border-size: 0;
    margin: 0;
    content: normal;
  }
}

@page title {
  margin: 1mm 1mm 1mm 1mm;
  @top-left {
    border-size: 0;
    margin: 0;
    content: normal;
  }
  @top-center {
    border-size: 0;
    margin: 0;
    content: normal;
  }
  @top-right {
    border-size: 0;
    margin: 0;
    content: normal;
  }
}

/* specific code for this image */
@page cover {
  size: 7.98cm 12cm;
  margin: 0 -2.01cm; /* make the virtual width 12cm */
}

body {
  font-size: 9.9pt;
  font-family: serif;
  text-align: justify;
  prince-image-resolution: 166dpi;
  hyphens: auto;
  prince-text-replace: " – " "—"       /*replace em-dashes*/
                       "st" "s\FEFFt"; /*disable st ligatures*/
}

body.cover {
  page: cover;
}

div.header {
  string-set: chaptitle content();
}

div.title, div.edition {
  page: title;
}
div.edition {
  float: bottom;
}

p.logo {
  display: none;
}

div.toc a {
  text-decoration: none;
}
div.toc a::after {
  content: leader('. ') target-counter(attr(href), page);
}

h1 {
  prince-bookmark-level: 1
}
(I also modified the main font.css file, to use FreeSans, and FreeSerif as default fonts for all conversions.)

And then on the directory with the ePUB files uncompressed, I ran:

Code:
prince OEBPS/Cover.xhtml OEBPS/Title.xhtml OEBPS/Contents.xhtml OEBPS/Preface.xhtml OEBPS/Chapter-*.xhtml -s pdf_output.css -o test.pdf
The only modification in the .xhtml was adding a "class=cover" in the body of Cover.xhtml, which I'll be probably adding in future ePUBs. Note how I changed back, on the fly, from "space-endash-space" no "emdash" The "st" ligatures are probably a fancy of the FreeSerif font, which I didn't want here.

Now I have to separate the "universal" stuff from the settings and classes particular to this ebook or to my coding style. I'd like to place the latter in a separate css file in the ePUB, and maybe use some metadata container for it, then a converter could use this for automatically convert the ePUB to PDF...

By the way, the logo watermark in the first page is quite easy to remove if you output the PDF with --no-compress (the pdf can later be compressed with pdftk).

Hii
I am not able to remove the logo watermark from the first page... How you have done it.
Thanks
ahsin_111 is offline   Reply With Quote