<?php
	$sheetNumber = $_GET['sheetNumber'];
	$oid = $_GET['oid'];
	
	require_once ( 'database.php' );

   	$connection = OpenDatabase();
	
    pg_query ( $connection, 'BEGIN' );
	
    pg_lo_export ( $connection, $oid, "C:\\Program Files (x86)\\PostgreSQL\\EnterpriseDB-ApachePHP\\apache\\www\\theta\\resources\\${sheetNumber}_$oid.pdf" );
	
    QueryDatabase ( $connection, 'COMMIT' );
	
	CloseDatabase ( $connection );
	
	header ( "Location:resources/${sheetNumber}_$oid.pdf" );
?>

<?php
	$sheetNumber = $_GET['sheetNumber'];
	$oid = $_GET['oid'];
	
	require_once ( 'database.php' );

   	$connection = OpenDatabase();
	
    pg_query ( $connection, 'BEGIN' );
	
	$loid = pg_loopen ( $connection, $oid, 'r' );

    header ( 'Content-type: application/pdf' );

    pg_loreadall ( $loid );
    pg_loclose ( $loid );
	
    QueryDatabase ( $connection, 'COMMIT' );
	
	CloseDatabase ( $connection );
?>

Use pg_loreadall to load lo from PostgreSQL
Use pg_loreadall to load lo from PostgreSQL

Use pg_loreadall instead of pg_lo_export to read PDF resource from PostgreSQL database, using the application/pdf MIME type to ensure the file is rendered as a PDF file.