-
-
Save aminophen/fdc3dfa320d9f0c32aeb to your computer and use it in GitHub Desktop.
Revisions
-
aminophen revised this gist
Aug 6, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,7 +1,7 @@ @echo off echo tcpdfcrop v0.9.4 (2015-08-06) setlocal if /I "%~1"=="/h" ( set BBOX=HiResBoundingBox shift ) else ( -
aminophen revised this gist
Jul 25, 2015 . 2 changed files with 25 additions and 83 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,14 +1,23 @@ @echo off echo tcpdfcrop v0.9.3 (2015-07-25) setlocal if /I "%1"=="/h" ( set BBOX=HiResBoundingBox shift ) else ( set BBOX=BoundingBox ) set FROMDIR=%~dp1 set FROM=%~n1 set TODIR=%~dp2 set TO=%~n2 set RANGE=%~3 set TPX=_tcpc set CROPTEMP=croptemp if "%FROM%"=="" ( echo Usage: tcpdfcrop [/h] in.pdf [out.pdf] [page-range] [left-margin] [top-margin] [right-margin] [bottom-margin] echo Option /h uses HiResBoundingBox instead of BoundingBox. ) if not exist "%FROMDIR%%FROM%.pdf" exit /B if not "%TEMP%"=="" cd "%TEMP%" copy "%FROMDIR%%FROM%.pdf" "%CROPTEMP%.pdf" 1>nul @@ -26,17 +35,17 @@ set /P VERSION=<"%CROPTEMP%-version.txt" set VERSION=%VERSION:*.=% del "%CROPTEMP%.xbb" "%CROPTEMP%-pages.txt" "%CROPTEMP%-version.txt" for /F "tokens=1,2 delims=-" %%m in ("%RANGE%") do ( set FIRST=%%m set LAST=%%n ) if "%FIRST%"=="" set FIRST=1 if "%FIRST%"=="*" set FIRST=1 if "%LAST%"=="" ( if "%RANGE%"=="" ( set LAST=%NUM% ) else ( set LAST=%FIRST% ) ) if "%LAST%"=="*" set LAST=%NUM% set LMARGIN=%~4 @@ -50,13 +59,13 @@ if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex echo \pdfminorversion=%VERSION% >>%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%CROPTEMP%.pdf" 2>&1 | find "%%%BBOX%: " >%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %LMARGIN%bp\relax \advance\pdfpagewidth by %LMARGIN%bp\relax \advance\pdfpagewidth by %RMARGIN%bp\relax^ \advance\pdfvorigin by -%BMARGIN%bp\relax \advance\pdfpageheight by %BMARGIN%bp\relax \advance\pdfpageheight by %TMARGIN%bp\relax^ \setbox0=\hbox{\pdfximage page %%i mediabox{%CROPTEMP%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax >>%TPX%n.tex ) echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex 1>nul This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,67 +0,0 @@ -
aminophen revised this gist
Apr 10, 2015 . 2 changed files with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.9.2 (2015-04-10) setlocal set FROMDIR=%~dp1 set FROM=%~n1 This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop-hires v0.9.2 (2015-04-10) setlocal set FROMDIR=%~dp1 set FROM=%~n1 @@ -50,7 +50,7 @@ if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex echo \pdfminorversion=%VERSION% >>%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%CROPTEMP%.pdf" 2>&1 | find "%%HiResBoundingBox: " >%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %LMARGIN%bp\relax \advance\pdfpagewidth by %LMARGIN%bp\relax \advance\pdfpagewidth by %RMARGIN%bp\relax^ -
aminophen revised this gist
Apr 10, 2015 . 2 changed files with 44 additions and 36 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,30 @@ @echo off echo tcpdfcrop v0.9.1 (2015-04-10) setlocal set FROMDIR=%~dp1 set FROM=%~n1 set TODIR=%~dp2 set TO=%~n2 set RANGE=%~3 set TPX=_tcpc set CROPTEMP=croptemp if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] [page-range] [left-margin] [top-margin] [right-margin] [bottom-margin] if not exist "%FROMDIR%%FROM%.pdf" exit /B if not "%TEMP%"=="" cd "%TEMP%" copy "%FROMDIR%%FROM%.pdf" "%CROPTEMP%.pdf" 1>nul if "%TO%"=="" set TO=%FROM%-crop if "%TODIR%"=="" set TODIR=%FROMDIR% if "%TODIR%%TO%"=="%FROMDIR%%FROM%" set TO=%FROM%-crop if exist "%TODIR%%TO%.pdf" del "%TODIR%%TO%.pdf" if exist "%TODIR%%TO%.pdf" exit /B extractbb "%CROPTEMP%.pdf" type "%CROPTEMP%.xbb" | find "%%Pages: " > "%CROPTEMP%-pages.txt" set /P NUM=<"%CROPTEMP%-pages.txt" set NUM=%NUM:* =% type "%CROPTEMP%.xbb" | find "%%PDFVersion: " > "%CROPTEMP%-version.txt" set /P VERSION=<"%CROPTEMP%-version.txt" set VERSION=%VERSION:*.=% del "%CROPTEMP%.xbb" "%CROPTEMP%-pages.txt" "%CROPTEMP%-version.txt" for /F "tokens=1,2 delims=-" %%m in ("%RANGE%") do ( set FIRST=%%m set LAST=%%n @@ -47,17 +50,18 @@ if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex echo \pdfminorversion=%VERSION% >>%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%CROPTEMP%.pdf" 2>&1 | find "%%BoundingBox: " >%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %LMARGIN%bp\relax \advance\pdfpagewidth by %LMARGIN%bp\relax \advance\pdfpagewidth by %RMARGIN%bp\relax^ \advance\pdfvorigin by -%BMARGIN%bp\relax \advance\pdfpageheight by %BMARGIN%bp\relax \advance\pdfpageheight by %TMARGIN%bp\relax^ \setbox0=\hbox{\pdfximage page %%i mediabox{%CROPTEMP%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax >>%TPX%n.tex ) echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex 1>nul for /L %%i in (%FIRST%,1,%LAST%) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log %CROPTEMP%.pdf if not exist %TPX%n.pdf exit /B move "%TPX%n.pdf" "%TODIR%%TO%.pdf" 1>nul echo ==^> %FIRST%-%LAST% page(s) written on "%TODIR%%TO%.pdf". This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,27 +1,30 @@ @echo off echo tcpdfcrop-hires v0.9.1 (2015-04-10) setlocal set FROMDIR=%~dp1 set FROM=%~n1 set TODIR=%~dp2 set TO=%~n2 set RANGE=%~3 set TPX=_tcpc set CROPTEMP=croptemp if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] [page-range] [left-margin] [top-margin] [right-margin] [bottom-margin] if not exist "%FROMDIR%%FROM%.pdf" exit /B if not "%TEMP%"=="" cd "%TEMP%" copy "%FROMDIR%%FROM%.pdf" "%CROPTEMP%.pdf" 1>nul if "%TO%"=="" set TO=%FROM%-crop if "%TODIR%"=="" set TODIR=%FROMDIR% if "%TODIR%%TO%"=="%FROMDIR%%FROM%" set TO=%FROM%-crop if exist "%TODIR%%TO%.pdf" del "%TODIR%%TO%.pdf" if exist "%TODIR%%TO%.pdf" exit /B extractbb "%CROPTEMP%.pdf" type "%CROPTEMP%.xbb" | find "%%Pages: " > "%CROPTEMP%-pages.txt" set /P NUM=<"%CROPTEMP%-pages.txt" set NUM=%NUM:* =% type "%CROPTEMP%.xbb" | find "%%PDFVersion: " > "%CROPTEMP%-version.txt" set /P VERSION=<"%CROPTEMP%-version.txt" set VERSION=%VERSION:*.=% del "%CROPTEMP%.xbb" "%CROPTEMP%-pages.txt" "%CROPTEMP%-version.txt" for /F "tokens=1,2 delims=-" %%m in ("%RANGE%") do ( set FIRST=%%m set LAST=%%n @@ -47,17 +50,18 @@ if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex echo \pdfminorversion=%VERSION% >>%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%CROPTEMP%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %LMARGIN%bp\relax \advance\pdfpagewidth by %LMARGIN%bp\relax \advance\pdfpagewidth by %RMARGIN%bp\relax^ \advance\pdfvorigin by -%BMARGIN%bp\relax \advance\pdfpageheight by %BMARGIN%bp\relax \advance\pdfpageheight by %TMARGIN%bp\relax^ \setbox0=\hbox{\pdfximage page %%i mediabox{%CROPTEMP%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax >>%TPX%n.tex ) echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex 1>nul for /L %%i in (%FIRST%,1,%LAST%) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log %CROPTEMP%.pdf if not exist %TPX%n.pdf exit /B move "%TPX%n.pdf" "%TODIR%%TO%.pdf" 1>nul echo ==^> %FIRST%-%LAST% page(s) written on "%TODIR%%TO%.pdf". -
aminophen revised this gist
Mar 31, 2015 . 2 changed files with 65 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.9 (2015-04-01) setlocal set FROMDIR=%~dp1 set TODIR=%~dp2 @@ -47,7 +47,7 @@ if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex echo \pdfminorversion=%VERSION% >>%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>&1 | find "%%BoundingBox: " >%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %LMARGIN%bp\relax \advance\pdfpagewidth by %LMARGIN%bp\relax \advance\pdfpagewidth by %RMARGIN%bp\relax^ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,63 @@ @echo off echo tcpdfcrop-hires v0.8.2 (2015-03-31) setlocal set FROMDIR=%~dp1 set TODIR=%~dp2 set FROM=%~n1 set TO=%~n2 set RANGE=%~3 set TPX=_tcpc if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] [page-range] [left-margin] [top-margin] [right-margin] [bottom-margin] if not "%FROMDIR%"=="" cd "%FROMDIR%" if not exist "%FROM%.pdf" exit /B if "%TO%"=="" set TO=%FROM%-crop if "%TO%"=="%FROM%" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B extractbb "%FROM%.pdf" type "%FROM%.xbb" | find "%%Pages: " > "%FROM%-pages.txt" set /P NUM=<"%FROM%-pages.txt" set NUM=%NUM:* =% type "%FROM%.xbb" | find "%%PDFVersion: " > "%FROM%-version.txt" set /P VERSION=<"%FROM%-version.txt" set VERSION=%VERSION:*.=% del "%FROM%.xbb" "%FROM%-pages.txt" "%FROM%-version.txt" for /F "tokens=1,2 delims=-" %%m in ("%RANGE%") do ( set FIRST=%%m set LAST=%%n ) if "%FIRST%"=="" set FIRST=1 if "%FIRST%"=="*" set FIRST=1 if "%LAST%"=="" ( if "%RANGE%"=="" ( set LAST=%NUM% ) else ( set LAST=%FIRST% ) ) if "%LAST%"=="*" set LAST=%NUM% set LMARGIN=%~4 set TMARGIN=%~5 set RMARGIN=%~6 set BMARGIN=%~7 if "%LMARGIN%"=="" set LMARGIN=0 if "%TMARGIN%"=="" set TMARGIN=0 if "%RMARGIN%"=="" set RMARGIN=0 if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex echo \pdfminorversion=%VERSION% >>%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %LMARGIN%bp\relax \advance\pdfpagewidth by %LMARGIN%bp\relax \advance\pdfpagewidth by %RMARGIN%bp\relax^ \advance\pdfvorigin by -%BMARGIN%bp\relax \advance\pdfpageheight by %BMARGIN%bp\relax \advance\pdfpageheight by %TMARGIN%bp\relax^ \setbox0=\hbox{\pdfximage page %%i mediabox{%FROM%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax >>%TPX%n.tex ) echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log if not exist %TPX%n.pdf exit /B move "%FROMDIR%%TPX%n.pdf" "%TODIR%%TO%.pdf" -
aminophen revised this gist
Mar 30, 2015 . 1 changed file with 6 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.8.2 (2015-03-31) setlocal set FROMDIR=%~dp1 set TODIR=%~dp2 @@ -18,7 +18,10 @@ extractbb "%FROM%.pdf" type "%FROM%.xbb" | find "%%Pages: " > "%FROM%-pages.txt" set /P NUM=<"%FROM%-pages.txt" set NUM=%NUM:* =% type "%FROM%.xbb" | find "%%PDFVersion: " > "%FROM%-version.txt" set /P VERSION=<"%FROM%-version.txt" set VERSION=%VERSION:*.=% del "%FROM%.xbb" "%FROM%-pages.txt" "%FROM%-version.txt" for /F "tokens=1,2 delims=-" %%m in ("%RANGE%") do ( set FIRST=%%m set LAST=%%n @@ -42,6 +45,7 @@ if "%TMARGIN%"=="" set TMARGIN=0 if "%RMARGIN%"=="" set RMARGIN=0 if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex echo \pdfminorversion=%VERSION% >>%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ -
aminophen revised this gist
Mar 25, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.8.1 (2015-03-25) setlocal set FROMDIR=%~dp1 set TODIR=%~dp2 -
aminophen revised this gist
Mar 25, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -15,7 +15,7 @@ if "%TO%"=="%FROM%" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B extractbb "%FROM%.pdf" type "%FROM%.xbb" | find "%%Pages: " > "%FROM%-pages.txt" set /P NUM=<"%FROM%-pages.txt" set NUM=%NUM:* =% del "%FROM%.xbb" "%FROM%-pages.txt" -
aminophen revised this gist
Mar 22, 2015 . 1 changed file with 29 additions and 9 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,11 +1,11 @@ @echo off echo tcpdfcrop v0.8 (2015-03-23) setlocal set FROMDIR=%~dp1 set TODIR=%~dp2 set FROM=%~n1 set TO=%~n2 set RANGE=%~3 set TPX=_tcpc if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] [page-range] [left-margin] [top-margin] [right-margin] [bottom-margin] if not "%FROMDIR%"=="" cd "%FROMDIR%" @@ -19,21 +19,41 @@ type "%FROM%.xbb" | find "Pages" > "%FROM%-pages.txt" set /P NUM=<"%FROM%-pages.txt" set NUM=%NUM:* =% del "%FROM%.xbb" "%FROM%-pages.txt" for /F "tokens=1,2 delims=-" %%m in ("%RANGE%") do ( set FIRST=%%m set LAST=%%n ) if "%FIRST%"=="" set FIRST=1 if "%FIRST%"=="*" set FIRST=1 if "%LAST%"=="" ( if "%RANGE%"=="" ( set LAST=%NUM% ) else ( set LAST=%FIRST% ) ) if "%LAST%"=="*" set LAST=%NUM% set LMARGIN=%~4 set TMARGIN=%~5 set RMARGIN=%~6 set BMARGIN=%~7 if "%LMARGIN%"=="" set LMARGIN=0 if "%TMARGIN%"=="" set TMARGIN=0 if "%RMARGIN%"=="" set RMARGIN=0 if "%BMARGIN%"=="" set BMARGIN=0 echo \pdfoutput=1 >%TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do ( rungs -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %LMARGIN%bp\relax \advance\pdfpagewidth by %LMARGIN%bp\relax \advance\pdfpagewidth by %RMARGIN%bp\relax^ \advance\pdfvorigin by -%BMARGIN%bp\relax \advance\pdfpageheight by %BMARGIN%bp\relax \advance\pdfpageheight by %TMARGIN%bp\relax^ \setbox0=\hbox{\pdfximage page %%i mediabox{%FROM%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax >>%TPX%n.tex ) echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex for /L %%i in (%FIRST%,1,%LAST%) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log if not exist %TPX%n.pdf exit /B move "%FROMDIR%%TPX%n.pdf" "%TODIR%%TO%.pdf" -
aminophen revised this gist
Mar 22, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.7.1 (2015-03-23) setlocal set FROMDIR=%~dp1 set TODIR=%~dp2 @@ -8,7 +8,7 @@ set TO=%~n2 set RANGE=%3 set TPX=_tcpc if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] [page-range] [left-margin] [top-margin] [right-margin] [bottom-margin] if not "%FROMDIR%"=="" cd "%FROMDIR%" if not exist "%FROM%.pdf" exit /B if "%TO%"=="" set TO=%FROM%-crop if "%TO%"=="%FROM%" set TO=%FROM%-crop -
aminophen revised this gist
Mar 21, 2015 . 1 changed file with 15 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,20 +1,30 @@ @echo off echo tcpdfcrop v0.7 (2015-03-19) setlocal set FROMDIR=%~dp1 set TODIR=%~dp2 set FROM=%~n1 set TO=%~n2 set RANGE=%3 set TPX=_tcpc if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] [page-range] [left-margin] [top-margin] [right-margin] [bottom-margin] cd "%FROMDIR%" if not exist "%FROM%.pdf" exit /B if "%TO%"=="" set TO=%FROM%-crop if "%TO%"=="%FROM%" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B extractbb "%FROM%.pdf" type "%FROM%.xbb" | find "Pages" > "%FROM%-pages.txt" set /P NUM=<"%FROM%-pages.txt" set NUM=%NUM:* =% del "%FROM%.xbb" "%FROM%-pages.txt" if "%NUM%"=="" set NUM=1 if exist %TPX%n.tex del %TPX%n.tex echo \pdfoutput=1 >%TPX%n.tex for /L %%i in (1,1,%NUM%) do ( gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input %TPX%%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %4bp\relax \advance\pdfpagewidth by %4bp\relax \advance\pdfpagewidth by %6bp\relax^ \advance\pdfvorigin by -%7bp\relax \advance\pdfpageheight by %7bp\relax \advance\pdfpageheight by %5bp\relax^ @@ -26,4 +36,4 @@ pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex for /L %%i in (1,1,%NUM%) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log if not exist %TPX%n.pdf exit /B move "%FROMDIR%%TPX%n.pdf" "%TODIR%%TO%.pdf" -
aminophen revised this gist
Mar 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,7 +5,7 @@ set FROM=%~n1 set TO=%~n2 set NUM=%3 set TPX=_tcpc if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] [pagenum] [left-margin] [top-margin] [right-margin] [bottom-margin] if not exist "%FROM%.pdf" exit /B if "%TO%"=="" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" -
aminophen revised this gist
Mar 15, 2015 . 1 changed file with 2 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.6.1 (2015-03-15) setlocal set FROM=%~n1 set TO=%~n2 @@ -11,9 +11,8 @@ if "%TO%"=="" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B if "%NUM%"=="" set NUM=1 if exist %TPX%n.tex del %TPX%n.tex for /L %%i in (1,1,%NUM%) do ( gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ -
aminophen revised this gist
Mar 15, 2015 . 1 changed file with 3 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.6 (2015-03-15) setlocal set FROM=%~n1 set TO=%~n2 @@ -17,6 +17,8 @@ if exist "%TPX%%%i.tex" del "%TPX%%%i.tex" gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \advance\pdfhorigin by %4bp\relax \advance\pdfpagewidth by %4bp\relax \advance\pdfpagewidth by %6bp\relax^ \advance\pdfvorigin by -%7bp\relax \advance\pdfpageheight by %7bp\relax \advance\pdfpageheight by %5bp\relax^ \setbox0=\hbox{\pdfximage page %%i mediabox{%FROM%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax >>%TPX%n.tex ) -
aminophen revised this gist
Mar 15, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -11,7 +11,9 @@ if "%TO%"=="" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B if "%NUM%"=="" set NUM=1 if exist "%TPX%n.tex" del "%TPX%n.tex" for /L %%i in (1,1,%NUM%) do ( if exist "%TPX%%%i.tex" del "%TPX%%%i.tex" gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ @@ -20,7 +22,7 @@ echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2] ) echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex for /L %%i in (1,1,%NUM%) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log if not exist %TPX%n.pdf exit /B ren %TPX%n.pdf "%TO%.pdf" -
aminophen revised this gist
Mar 15, 2015 . 1 changed file with 4 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,13 +3,15 @@ echo tcpdfcrop v0.5 (2015-03-15) setlocal set FROM=%~n1 set TO=%~n2 set NUM=%3 set TPX=_tcpc if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] if not exist "%FROM%.pdf" exit /B if "%TO%"=="" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B if "%NUM%"=="" set NUM=1 for /L %%i in (1,1,%NUM%) do ( gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ @@ -20,5 +22,5 @@ echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex if not exist %TPX%n.pdf exit /B ren %TPX%n.pdf "%TO%.pdf" for /L %%i in (1,1,%NUM%) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log -
aminophen revised this gist
Mar 15, 2015 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,5 +1,5 @@ @echo off echo tcpdfcrop v0.5 (2015-03-15) setlocal set FROM=%~n1 set TO=%~n2 -
aminophen revised this gist
Mar 15, 2015 . 1 changed file with 14 additions and 8 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,18 +1,24 @@ @echo off echo tcpdfcrop v0.4 (2015-02-08) setlocal set FROM=%~n1 set TO=%~n2 set TPX=_tcpc if "%FROM%"=="" echo Usage: tcpdfcrop in.pdf [out.pdf] if not exist "%FROM%.pdf" exit /B if "%TO%"=="" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B for /L %%i in (1,1,%3) do ( gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox -dFirstPage=%%i -dLastPage=%%i "%FROM%.pdf" 2>%TPX%%%i.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc%%i.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \setbox0=\hbox{\pdfximage page %%i mediabox{%FROM%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax >>%TPX%n.tex ) echo \end >>%TPX%n.tex pdftex -no-shell-escape -interaction=batchmode %TPX%n.tex if not exist %TPX%n.pdf exit /B ren %TPX%n.pdf "%TO%.pdf" for /L %%i in (1,1,%3) do del %TPX%%%i.tex del %TPX%n.tex %TPX%n.log -
aminophen revised this gist
Feb 7, 2015 . 1 changed file with 5 additions and 5 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,16 +3,16 @@ setlocal set FROM=%~n1 set TO=%~n2 set TPX=_tcpc if not exist "%FROM%.pdf" exit /B if "%TO%"=="" set TO=%FROM%-crop if exist "%TO%.pdf" del "%TO%.pdf" if exist "%TO%.pdf" exit /B gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox "%FROM%.pdf" 2>%TPX%1.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc1.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \setbox0=\hbox{\pdfximage mediabox{%FROM%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax \end >%TPX%2.tex pdftex -no-shell-escape -interaction=batchmode %TPX%2.tex if not exist %TPX%2.pdf exit /B ren %TPX%2.pdf "%TO%.pdf" del %TPX%1.tex %TPX%2.tex %TPX%2.log -
aminophen revised this gist
Feb 7, 2015 . 1 changed file with 2 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -6,7 +6,7 @@ set TPX=_tcpc if not exist %FROM%.pdf exit /B if "%TO%"=="" set TO=%FROM%-crop if exist %TO%.pdf del %TO%.pdf if exist %TO%.pdf exit /B gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox %FROM%.pdf 2>%TPX%1.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc1.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ @@ -15,4 +15,4 @@ echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2] pdftex -no-shell-escape -interaction=batchmode %TPX%2.tex if not exist %TPX%2.pdf exit /B ren %TPX%2.pdf %TO%.pdf del %TPX%1.tex %TPX%2.tex %TPX%2.log -
aminophen revised this gist
Feb 7, 2015 . 1 changed file with 3 additions and 3 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,15 +4,15 @@ set FROM=%~n1 set TO=%~n2 set TPX=_tcpc if not exist %FROM%.pdf exit /B if "%TO%"=="" set TO=%FROM%-crop if exist %TO%.pdf del %TO%.pdf if exist %TO%.pdf del exit /B gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox %FROM%.pdf 2>%TPX%1.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc1.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \setbox0=\hbox{\pdfximage mediabox{%FROM%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax \end >%TPX%2.tex pdftex -no-shell-escape -interaction=batchmode %TPX%2.tex if not exist %TPX%2.pdf exit /B ren %TPX%2.pdf %TO%.pdf del %TPX%1.tex %TPX%2.tex %TPX%2.log -
zr-tex8r created this gist
Oct 16, 2014 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,18 @@ @echo off setlocal set FROM=%~n1 set TO=%~n2 set TPX=_tcpc if not exist %FROM%.pdf exit /B if "%TO%"=="" exit /B if exist %TO%.pdf del %TO%.pdf if exist %TO%.pdf del exit /B gswin32c -dBATCH -dNOPAUSE -q -sDEVICE=bbox %FROM%.pdf 2>%TPX%1.tex echo {\catcode37=13 \catcode13=12 \def^^^^25^^^^25#1: #2^^^^M{\gdef\do{\proc[#2]}}\input _tcpc1.tex\relax}{}^ \def\proc[#1 #2 #3 #4]{\pdfhorigin-#1bp \pdfvorigin#2bp \pdfpagewidth=\dimexpr#3bp-#1bp\relax\pdfpageheight\dimexpr#4bp-#2bp\relax}\do^ \setbox0=\hbox{\pdfximage mediabox{%FROM%.pdf}\pdfrefximage\pdflastximage}^ \ht0=\pdfpageheight \shipout\box0\relax \end >%TPX%2.tex pdftex -no-shell-escape -batchmode %TPX%2.tex if not exist %TPX%2.pdf exit /B ren %TPX%2.pdf %TO%.pdf del %TPX%1.tex %TPX%2.tex %TPX%2.log