Register Guidelines E-Books Today's Posts Search

Go Back   MobileRead Forums > E-Book Software > Calibre > Conversion

Notices

Reply
 
Thread Tools Search this Thread
Old 10-08-2024, 04:06 AM   #1
Blaineoreski
Zealot
Blaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcover
 
Blaineoreski's Avatar
 
Posts: 118
Karma: 16268
Join Date: Apr 2020
Device: none
Question Anyway to Create Headers and Footers Such That They Can't Be Selected

Hi!

Often times I'll be copying across a pagebreaks in PDF. I generate headers and footers from the GUI, EPUB >> PDF, with this:

<header style="justify-content: flex-end; color: gray; font-size: small;padding-top: 20px;"><div class="odd-page"><i>_SECTION_</i></div></header>
<p style="text-align:center; color: gray; font-size: small"> _PAGENUM_</p>

When you drag the select across the pagebreak you'll get all those details in the selection.

Anyway to suppress that? Such that the headers and footers are NON-selectable?

I've got PDF X-change editor, so if there are any tools there you can think of, that'd work, too. But, question is - in going from Epub to PDF - any way to set the headers and footers into the page so they can't be copied?

Thanks!
Blaineoreski is offline   Reply With Quote
Old 10-08-2024, 04:53 AM   #2
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,564
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
No as far as I know there is no way to make text in a pdf not copyable, regardless of its location.
kovidgoyal is online now   Reply With Quote
Advert
Old 10-09-2024, 02:04 AM   #3
Blaineoreski
Zealot
Blaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcover
 
Blaineoreski's Avatar
 
Posts: 118
Karma: 16268
Join Date: Apr 2020
Device: none
Yep, yep! Roger that.

Are there any other formats you can think of that sort of get around this wee quirk of PDF?

One idea that occurred to me was to sort of render the headings FIRST? And, then transform them into background images? I mean - that'd be a whole other step, for sure, in the conversion process EPUB >> PDF, but it would be sort of a sweet win.

The thing about the headings is a pain - almost like having the filename you're working on appended to any copy and paste. The files I use are all loooooooong from, and many a time I've had to go fish out the information. Whenever I'm on a conceptual roll, it's always a huge sort of mental momentum breaker for me. Half the time I'll just leave them in to keep the any motion going - but that's even worse in a way - coming back to find something floating around in notes I've made that's only like half the author's name and a page number, or a sub-chapter title.

What do you think? Does my switch to background image before rendering text in body of pages have any validity?

And! THANK YOU for Calibre! RARE have so many owed so much to - one GUY! Calbre is the jam, Kovid. THANK YOU! ))
Blaineoreski is offline   Reply With Quote
Old 10-09-2024, 03:06 AM   #4
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,564
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Just use EPUB with a reader that displays section titles in the header or footer such as the calibre viewer.
kovidgoyal is online now   Reply With Quote
Old 10-09-2024, 11:14 AM   #5
Blaineoreski
Zealot
Blaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcover
 
Blaineoreski's Avatar
 
Posts: 118
Karma: 16268
Join Date: Apr 2020
Device: none
I need to use a PDF reader - actually one specific one for the research I'm doing.

Are there any plugins for Calibre that do anything similar EPUB >> PDF? Or, even, PDF >> PDF?

Could it be added as a feature?

Here's my thinking - once the headers are added at the GUI in Calibre's conversion - there's not really any upside to having them copy and pasteable.

How does that sound?

Sincerely,

Ski
Blaineoreski is offline   Reply With Quote
Advert
Old 10-09-2024, 11:48 AM   #6
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,564
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Not something I am interested in implementing, sorry.
kovidgoyal is online now   Reply With Quote
Old 10-09-2024, 12:12 PM   #7
theducks
Well trained by Cats
theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.theducks ought to be getting tired of karma fortunes by now.
 
theducks's Avatar
 
Posts: 30,451
Karma: 58055868
Join Date: Aug 2009
Location: The Central Coast of California
Device: Kobo Libra2,Kobo Aura2v1, K4NT(Fixed: New Bat.), Galaxy Tab A
Quote:
Originally Posted by Blaineoreski View Post
I need to use a PDF reader - actually one specific one for the research I'm doing.

Are there any plugins for Calibre that do anything similar EPUB >> PDF? Or, even, PDF >> PDF?

Could it be added as a feature?

Here's my thinking - once the headers are added at the GUI in Calibre's conversion - there's not really any upside to having them copy and pasteable.

How does that sound?

Sincerely,

Ski
Are you trying to create a form of copy protection (DRM)?
Make your headers an Image
theducks is offline   Reply With Quote
Old 10-10-2024, 01:51 AM   #8
Blaineoreski
Zealot
Blaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcover
 
Blaineoreski's Avatar
 
Posts: 118
Karma: 16268
Join Date: Apr 2020
Device: none
Hi, Kovid!

Yep, yep. Alright. Thanks for giving it a look.

Hi, theducks!

No, not DRM. A way to not have to go back every time you copy across where there's a page break and then not need to go back and excise out the headers and/or footers.

So that, instead of

Sides DJ and HE, and by the transverse Line FG distinguished into two halfs, the one DG of an intensely blue Colour, the other FE of an intensely red. And BACcab represents the Prism whose refracting Planes ABba and ACca meet in the Edge of the refracting Angle Aa. This Newton Optiks PROPOSITIONS. PROP. I. Theor. I. 19 Edge Aa being upward, is parallel both to the Horizon, and to the Parallel-Edges of the Paper DJ and HE, and the transverse Line FG is perpendicular to the Plane of the Window. And de represents the Image of the Paper seen by Refraction

you'd get:

Sides DJ and HE, and by the transverse Line FG distinguished into two halfs, the one DG of an intensely blue Colour, the other FE of an intensely red. And BACcab represents the Prism whose refracting Planes ABba and ACca meet in the Edge of the refracting Angle Aa. This Edge Aa being upward, is parallel both to the Horizon, and to the Parallel-Edges of the Paper DJ and HE, and the transverse Line FG is perpendicular to the Plane of the Window. And de represents the Image of the Paper seen by Refraction

You wrote,

MAKE YOUR HEADERS AN IMAGE

That's what I was thinking of. Some way to get this step

https://ibb.co/K0WFHfz

to create itself as an image, or as being otherwise unselectable.
Blaineoreski is offline   Reply With Quote
Old 10-10-2024, 04:45 AM   #9
Jaws
JCL Punch-Card Collector
Jaws began at the beginning.
 
Posts: 58
Karma: 10
Join Date: Jun 2014
Location: Antarctica
Device: Aggressively Device Independent
If you don't care about anything that is in the headers and footers in the PDF, try cropping the page to omit them (there are lots of free/open-source editors out there that will crop the page — just don't use any Adobe product, they don't actually "crop" but "mask"). This might turn a 6x9 (printed size, US sizing) page to 6x8.25. Then, to be certain, run the cropped PDF through a PDF printer (to create a new PDF), and use that last PDF as the source for any later conversions/editing/whatever.

I've done this process with journal articles from Springer with about 80% success. It's been about 60% success with books, but it's a small sample size (and the fails were from OUP).

The downside is that you'll lose page numbering, but that's actually easier to put back in later either manually (iteratively inserting a naming anchor) or with a regexp search-and-replace than it is to deal with textual headers/footers via regexp.
Jaws is offline   Reply With Quote
Old 10-10-2024, 06:08 AM   #10
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,284
Karma: 6433040
Join Date: Sep 2020
Device: Calibre E-book viewer
I was able to somehow make this work, following theducks' suggestion, by using the Prince PDF Calibre plugin and the below custom style:

PHP Code:
@page {
  
size17cm 33cm;
  
margin5mm 10mm 5mm 10mm !important;
    @
top-left {
    
font-size50%;
    
font-styleitalic;
    
border-bottomsolid thin black;
    
margin-bottom1mm;
    
content'';
    
displayblock;
    
width500px;
    
height50px;
    
background-imageurl('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 10 300 70"><text x="0" y="40" font-family="Arial" font-size="28" fill="red" font-weight="bold">svg header test: @{@{title}@}@</text></svg>');
    
background-size500px 30px;
  }
  
  
   @
bottom-left {
    
font-size50%;
    
font-styleitalic;
    
border-topsolid thin black;
    
margin-bottom1mm;
    
content'';
    
displayblock;
    
width500px;
    
height50px;
    
background-imageurl('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 10 300 70"><text x="0" y="40" font-family="Arial" font-size="28" fill="red" font-weight="bold">svg footer test: @{@{author}@}@</text></svg>');
    
background-size500px 30px;
  } 
The attached PDF is a conversion of this title from Gutenberg Australia (an excerpt, actually):
https://gutenberg.net.au/epub-ebooks...%20Orwell.epub

I couldn't figure out how to call the section name and page numbers in the svg, but perhaps Jellby over at the Prince plugin thread can give some insight.

By using
Code:
     content: string(chaptertitle);
     content: counter(page) "/" counter(pages);
...in the CSS, those elements can be displayed, however they end up being selectable.

Hope this helps!
Attached Files
File Type: pdf _Nineteen eighty-four - George Orwell_1_1.pdf (179.8 KB, 18 views)

Last edited by Comfy.n; 10-10-2024 at 06:12 AM.
Comfy.n is offline   Reply With Quote
Old 10-10-2024, 11:41 AM   #11
Blaineoreski
Zealot
Blaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcoverBlaineoreski exercises by bench pressing the entire Harry Potter series in hardcover
 
Blaineoreski's Avatar
 
Posts: 118
Karma: 16268
Join Date: Apr 2020
Device: none
Hi, Comfy.n,

Yeah! Lookit' THAT:

https://ibb.co/ykLxjwF

So, sounds like a combination of the plugin and the code. Buddy, that is WICKED cool!

Jaws!

Yeah - I've done that with articles like that, too! In the end, I always found, as I got deeper and deeper along, that I NEEDED the headings - that they HAVE a use - just no use in them getting copied all the time, eh?

This all looks promising!!!
Blaineoreski is offline   Reply With Quote
Old 10-10-2024, 01:09 PM   #12
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,564
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Well you can do that in calibre as well without needing SVG by using the canvas element. Something like this for a header template

Code:
<header><canvas><script>
canvas = document.currentScript.parentNode
canvas.height = canvas.parentNode.scrollHeight
canvas.width = 1400
ctx = canvas.getContext("2d");
ctx.font = (canvas.parentNode.scrollHeight / 2) + "px sans-serif"
ctx.fillStyle = 'yellow';
ctx.fillRect(0, 0, canvas.width, canvas.height)
ctx.fillStyle = 'black';
ctx.fillText("section: _SECTION_", 5, canvas.parentNode.scrollHeight / 2);
You will need to edit the various sizes to get it to work well for your conversion.

Last edited by kovidgoyal; 10-10-2024 at 02:18 PM.
kovidgoyal is online now   Reply With Quote
Old 10-10-2024, 08:49 PM   #13
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,284
Karma: 6433040
Join Date: Sep 2020
Device: Calibre E-book viewer
Quote:
Originally Posted by kovidgoyal View Post
You will need to edit the various sizes to get it to work well for your conversion.
For some reason I don't get the text to appear, even trying different values. I see only the yellow rectangle:
Attached Thumbnails
Click image for larger version

Name:	MWSnap 2024-10-10, 20_49_08.png
Views:	28
Size:	224.3 KB
ID:	211336   Click image for larger version

Name:	MWSnap 2024-10-10, 20_50_34.png
Views:	24
Size:	96.8 KB
ID:	211337  
Comfy.n is offline   Reply With Quote
Old 10-11-2024, 12:06 AM   #14
kovidgoyal
creator of calibre
kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.kovidgoyal ought to be getting tired of karma fortunes by now.
 
kovidgoyal's Avatar
 
Posts: 44,564
Karma: 24495948
Join Date: Oct 2006
Location: Mumbai, India
Device: Various
Play with ctx.font and ctx.fillText lines maybe try setting the height manually rather than relying on parentNode.scrollheight
kovidgoyal is online now   Reply With Quote
Old 10-11-2024, 04:11 AM   #15
Comfy.n
want to learn what I want
Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.Comfy.n ought to be getting tired of karma fortunes by now.
 
Posts: 1,284
Karma: 6433040
Join Date: Sep 2020
Device: Calibre E-book viewer
wheee, I got it.

going to post shortly
Comfy.n is offline   Reply With Quote
Reply


Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Books with headers and footers? gracie ePub 3 08-10-2012 09:04 AM
Where is remove Headers/Footers? Anarel Calibre 4 05-25-2011 05:36 PM
Removing Headers and Footers Here's What I Did allowingtoo Workshop 0 02-16-2011 09:46 PM
Removing Headers/Footers Help? Anarel Workshop 10 11-09-2010 01:53 PM
page headers/footers daesdaemar Workshop 20 12-12-2008 10:22 PM


All times are GMT -4. The time now is 06:51 AM.


MobileRead.com is a privately owned, operated and funded community.