Salta al contenuto principale
Working from scratch, following simplicity

Aggiunta una nuova funzione per il ritaglio online di un PDF con LaTeX

Ho aggiunto una nuova opzione al mio script LaTeX che taglia gli spazi vuoti da ogni PDF in modo interattivo e visivo: puoi ora aggiungere il numero di pagina nella parte inferiore del PDF risultante. Rimane sempre possibile eseguire il taglio online grazie a Overleaf, senza dover installare LaTeX nel proprio PC. Ed ora modificando due variabili: è possibile attivare/disattivare la funzione del numero di pagina e regolarne la distanza dalla parte inferiore della pagina.

Recentemente ho ritagliato un PDF che conteneva due pagine rimpicciolite per foglio prive di qualsiasi numerazione delle pagine, quindi dopo aver stampato il mio PDF ridimensionato e corretto, ho perso un sacco di tempo per ordinarlo. Ho aggiunto questa funzione per salvarmi da questo strazio in futuro!

Se vuoi scoprire tutte le funzionalità del mio script LaTeX, ti suggerisco di leggere l'articolo precedente: Come ritagliare e dividere un PDF online e in LaTeX ma senza usarlo.

Aggiunta una nuova funzione per il ritaglio online di un PDF con LaTeX

Guida passo passo

Qui al contrario ti mostro come funziona la nuova aggiunta con un semplice esempio.

  1. Carica il file PDF che vuoi ritagliare, imposta il nome nella variabile corretta in questo caso esempio.pdf, imposta correttamente la sua dimensione di pagina, il numero totale delle pagine che vuoi tagliare e la pagina iniziale da dove cominciare, includi solo il primo commento \includecomment {first}, metti double {1} se il tuo PDF contiene due pagine per foglio, altrimenti double {0}. Regola opportunamente la dimensione del rettangolo/i virtuale/i azzurro e posizionalo/i sistemando le coordinate.
    \includecomment{first} 		% for discovering the dimension of the cuts
    \excludecomment{second}		% for printing a cleaned and trimmed PDF
    \excludecomment{third}		% for joining the pages of the II stage without white spaces
    							% (save and use the new PDF before to do it)
    
    %%
    %% Define the file name and the dimension of your PDF
    %% Put the size in mm
    %% The typical size of an A4 document is 210x297 mm
    \newcommand\units{mm}					           % <--- set the units (default mm)
    \newcommand\fileName{example.pdf}		           % <--- the name of the PDF to process
    \newcommand\fileNameToJoin{example_trimmed.pdf}    % <--- the name of the PDF trimmed to join
    \newcommand\width{210} 					           % <--- the width size in mm of your PDF
    \newcommand\height{297} 				           % <--- the height size in mm of your PDF
    
    %%
    %% 							Do you want to crop the white spaces around the PDF?
    %%
    \newcommand\crop{1} 					% <-- "0" FALSE "1" TRUE
    % If true put the dimension of the virtual rectangle that covers the pages
    \newcommand\cutterW{130} 				% <--- the width size in mm of your cutter
    \newcommand\cutterH{100} 				% <--- the height size in mm of your cutter
    
    %%
    %% 							Do you want to cut two sections per page?
    %%
    \newcommand\double{1} 					% <--- "0" FALSE "1" TRUE
    %% If true put x_i, y_i the coordinates for moving the virtual rectangle in the page
    %% the system start at the bottom left of the whole page
    %% YOU CAN PUT ONLY INTEGER NUMBER
    %% first rectangle in page (generally odd) or the only one
    \newcommand\xOdd{40}					% <-- x_1
    \newcommand\yOdd{160}						% <-- y_1
    %% second rectangle in page (generally even)
    \newcommand\xEven{40}					% <-- x_2
    \newcommand\yEven{36}					% <-- y_2
    
    %%
    %% 							How many pages do you want to process?
    %% default pages + 1, pages +0 if there are two page increment in the 2 step
    
    \newcommand\numberPages{5} 				% <--- the numbers of pages
    \newcommand\firstPage{1} 				% <--- fix the first page to start
    
     Step 1
  2. Abilita solo il secondo commento \includecomment {second} e attiva il numero di pagina se ne hai bisogno nel PDF ritagliato risultante, dimensiona opportunamente la distanza dal basso, salva il PDF tagliato in questo caso nominato example_trimmed.pdf.
    \excludecomment{first} 		% for discovering the dimension of the cuts
    \includecomment{second}		% for printing a cleaned and trimmed PDF
    \excludecomment{third}		% for joining the pages of the II stage without white spaces
    							% (save and use the new PDF before to do it)
    [...]
    %%
    %%                          Do you want page number in the trimmed PDF?
    \newcommand\pagenumber{1} 					% <-- "0" FALSE "1" TRUE
    %% 							Fix the distance of the page number from the bottom
    \newcommand\distance{3.5} 				% <--- in mm
    
     Step 2
  3. L'ultimo comando è sperimentale e in fase di test, poiché le pagine unite non si adattano correttamente alle dimensioni della pagina: carica il PDF tagliato salvato nel secondo passaggio e imposta il suo nome nella variabile corrispondente, includi solo il terzo commento \includecomment {terzo} e controlla il risultato sullo schermo. Se lo trovi accettabile salva il nuovo PDF, altrimenti usa l'ultimo PDF e stampa 2 pagine per foglio dalle impostazioni di sistema della tua stampante.
    \excludecomment{first} 		% for discovering the dimension of the cuts
    \excludecomment{second}		% for printing a cleaned and trimmed PDF
    \includecomment{third}		% for joining the pages of the II stage without white spaces
    							% (save and use the new PDF before to do it)
    [...]
    \newcommand\fileNameToJoin{example_trimmed.pdf}    % <--- the name of the PDF trimmed to join
    [...]
    % -------------------------
    % 				THIRD STEP:
    % -------------------------
    % Useful if you want to join a cropped PDF
    %
    % Usage: nup=2x1 means print 2 columns x 1 row (= 2 pages per page)
    % To activated it: \includecomment{third}
    %
    % Save the PDF output of the II stage and load it (Project --> files)
    \begin{third}
       \includepdf[pages=-,templatesize={\the\numexpr\cutterW mm}{\the\numexpr\cutterH*1.5 mm}, nup=1x2, landscape=false, fitpaper=true]{\fileNameToJoin}%<-your last PDF
    \end{third}
    
     Step 3

Download

Puoi trovare o scaricare il mio template in Overleaf e/o GitHub ai seguenti link:

Aggiungi un commento

Il contenuto di questo campo è privato e non verrà mostrato pubblicamente.

Plain text

  • Nessun tag HTML consentito.
  • Indirizzi web ed indirizzi e-mail diventano automaticamente dei link.
  • Linee e paragrafi vanno a capo automaticamente.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.

Aggiungi un commento

Il contenuto di questo campo è privato e non verrà mostrato pubblicamente.

Plain text

  • Nessun tag HTML consentito.
  • Indirizzi web ed indirizzi e-mail diventano automaticamente dei link.
  • Linee e paragrafi vanno a capo automaticamente.
CAPTCHA
This question is for testing whether or not you are a human visitor and to prevent automated spam submissions.
Sponsored Links
Pubblicità

Nicola Rainiero

Ingegnere civile specializzato in geotecnica con l'ambizione di facilitare la propria attività lavorativa usando e creando software libero per un sapere condiviso e collettivo. Mi occupo anche di energie rinnovabili ed in particolare di geotermia a bassa entalpia. Sono da sempre appassionato di web design e modellazione 3D.