Add empty blank page (duplex)

in Workflow:

after metadata sorting during sequencing I want to add blank pages to documents with odd pages (simply for duplex printing). Next step is PDF-creation (passthru).

Can I just add empty datapages to the metadata? Does it render as an empty pdf page? How to achieve that?

Ralf.

First of all, what you explain here seems to be done using PlanetPress Suite 7 (Create PDF, metadata sorting, etc…)

If that is the case, please post in the proper forum for PlanetPress Suite. This forum if for Connect content.

Hi post history indicates otherwise :slight_smile:

hamelj,
this time (just pass-thru merged pdfs) I want to do it oldschool (via metadata).

Using connect I know how to solve that, but since workflow is actually part of our connect suite I’m wondering how to do that and this forum is called PlanetPress Connect Workflow.

So do I have to change forums if I want some help regarding tools still present in Connect?

:thinking:

Nope…you do not…I misunderstood your questions…sorry…:confounded::crazy_face::grin:

Here’s a reaaallllyyyyy old script I wrote to do exactly that (it was written in VBScript, which just shows how old it is!!!).
It appears to still work. The idea is that you add a blank page to the PDF itself, then add metadata elements that point to that blank page. That way, you don’t have to physically insert tons of blank pages inside the PDF.

You’ll probably have to tweak it:

'' This script pads PDF files for duplex outputs.
'' It adds a blank page at the end of the PDF and pads either
'' metadata groups, documents or pages by adding a reference to
'' this empty page when one of the above has an odd 
'' number of physical pages.
Option Explicit

Dim MyPDF, MyMeta, MyParams, MyLastPageIndex, i, j, k, isPageAdded, MyPDFRect

MyParams = Array("Document")

Set MyPDF = Watch.GetPDFEditObject
Set MyMeta = CreateObject("MetadataLib.MetaFile")

On Error Resume Next
MyPDF.Open Watch.GetJobFileName, False
if Err.Number <> 0 then
	Watch.Log "Error opening PDF job file",1
	On Error Goto 0
	Err.Raise 12, "", "Error opening PDF job file"
end if
On Error Goto 0
MyLastPageIndex = MyPDF.Pages.Count
set MyPDFRect = MyPDF.Pages.Item(MyLastPageIndex-1).Size 

On Error Resume Next
MyMeta.LoadFromFile Watch.GetMetadataFileName
if Err.Number <> 0 then
	Watch.Log "Error opening Metadata file",1
	On Error Goto 0
	Err.Raise 14, "", "Error opening Metadata file"
end if

On Error Goto 0
if MyParams(0)="Document"then
	'Pad Documents
	For i = 0 to MyMeta.Job.Count - 1
		for j = 0 to MyMeta.Job.Group(i).Count - 1 
			if MyMeta.Job.Group(i).Document(j).Selected then
				if (MyMeta.Job.Group(i).Document(j).SelectedPageCount mod 2 <> 0) then
					AddDataPageAfter LastSelectedDP(MyMeta.Job.Group(i).Document(j))
					Watch.Log "Added a page to Document "&j+1,3
				end if
			end if
		next	
	next
elseif MyParams(0)="Group" then
	'Pad groups
	For i = 0 to MyMeta.Job.Count - 1
		if (MyMeta.Job.Group(i).SelectedPageCount mod 2 <> 0) then
			AddDataPageAfter LastSelectedDP(LastSelectedDoc(MyMeta.Job.Group(i)))
		end if
	next
else
	'Pad Pages
	For i = 0 to MyMeta.Job.Count - 1
		for j = 0 to MyMeta.Job.Group(i).Count - 1 
			for k = 0 to MyMeta.Job.Group(i).Document(j).Count - 1 
				if MyMeta.Job.Group(i).Document(j).Datapage(k).Selected then
					AddDataPageAfter MyMeta.Job.Group(i).Document(j).Datapage(k)
				end if
			next
		next	
	next
end if

if isPageAdded then
	MyPDF.Pages.Insert MyLastPageIndex, MyPDFRect
	MyPDF.Save False
	MyMeta.SaveToFile Watch.GetMetadataFileName
  Watch.Log "PDF (pages=" & MyPDF.Pages.Count & ") & Meta saved",3

end if

'
' That's it... The rest of the code is just global functions
'

Sub AddDataPageAfter(oDP)
	if not (oDP is nothing) then
	  Set oDP = oDP.Parent.Add(oDP.Parent.Count)
		isPageAdded = True
		''
		'' TODO: check code
		''
		 oDP.RealIndex = MyLastPageIndex
		 oDP.Offset = MyLastPageIndex
		 odp.Add 0
	end if
end sub

Function LastSelectedDP(oDoc)
	Dim i
	Set LastSelectedDP=nothing
	if oDoc is Nothing then
		err.raise 1, "Padder", "Could not find any selected Document in the Metadata"
		exit function
	end if
	For i = oDoc.PageCount-1 to 0 step -1
		if oDoc.DataPage(i).Selected then
			Set LastSelectedDP=oDoc.DataPage(i)
			exit for
		end if
	next
End Function

Function LastSelectedDoc(oGroup)
	Dim i
	Set LastSelectedDoc=nothing
	if oGroup is Nothing then
		err.raise 1, "Padder", "Could not find any selected Group in the Metadata"
		exit function
	end if
	For i = oGroup.DocumentCount-1 to 0 step -1
		if oDoc.Document(i).Selected then
			Set LastSelectedDoc=oGroup.Document(i)
			exit for
		end if
	next
End Function

Function LastSelectedGroup(oJob)
	Dim i
	Set LastSelectedGroup=nothing
	For i = oJob.Count-1 to 0 step -1
		if oJob.Group(i).Selected then
			Set LastSelectedGroup=oJob.Group(i)
			exit for
		end if
	next
End Function
1 Like

Phil, exactly what I’ve been searching for!
and for passthru pdfs really fast.

thx a lot!

Ralf.

I’m just glad I keep an archive of most of these little projects I’ve done over the years.I just checked and this one was last modified in 2010!