2010-01-27 5 views
1

asp.net의 iframe에 PDF를 표시하는 데 문제가 있습니다. pdf가 나타나면 사용자가 확대/축소 및 인쇄 할 수있는 Acrobat 도구 모음없이 표시됩니다. 이는 PDF 크기의 문서를 읽을 수 없기 때문에 고객에게 큰 번거 로움을줍니다. Acrobat에서 PDF를 브라우저에 표시하지 않고 해당 페이지를 탐색하도록 설정하면 전체 화면 모드로 열려고한다는 메시지가 나타납니다. 어떻게하면 코드에서 이렇게 할 수없는 아이디어가 있습니까? 어도비 아크로뱃의 PDF는, 파일 속성 및 초기보기 탭을 클릭로 이동Acrobat 전체 화면 모드로 열기

Public Shared Sub StreamPdfToBrowser(ByVal doc As Document) 
    Dim Ctx As HttpContext = HttpContext.Current 
    '// Clear any part of this page that might have already been buffered for output. 
    Ctx.Response.Clear() 
    Ctx.Response.ClearHeaders() 

    '// Tell the browser this is a PDF document so it will use an appropriate viewer. 
    Ctx.Response.ContentType = doc.DisplayFileType 

    Ctx.Response.ContentType = "application/pdf" 
    Ctx.Response.AddHeader("content-type", "application/pdf") 

    '// IE & Acrobat seam to require "content-disposition" header being in the response. If you don't add it, the doc still works most of the time, but not always. 
    '// this makes a new window appear: 
    Response.AddHeader("content-disposition","attachment[inline]; filename=MyPDF.PDF"); 
    Ctx.Response.AddHeader("Content-Length", doc.DisplayFile.Length) 
    Ctx.Response.AddHeader("Content-Disposition", "inline; filename=E-Sign Specification Report.pdf") 

    '// TODO: Added by KN to possibly fix UA issue 
    Ctx.Response.ContentType = "application/pdf" 
    Ctx.Response.AddHeader("content-type", "application/pdf") 

    '// Write the PDF stream out 
    Ctx.Response.BinaryWrite(doc.DisplayFile) 

    '// Send all buffered content to the client 
    Ctx.Response.End() 
End Sub 

답변

0

시작 : 아래는 내가 브라우저에 PDF를 스트리밍하는 데 사용하는 코드입니다. 여기서 사람들이이 특정 PDF를 열 때 기본보기를 설정할 수 있습니다. "전체 화면 모드로 열기"가 선택되어있는 것처럼 들립니다.

+0

전체 화면 모드를 사용하지 않도록 PDF 옵션을 설정했지만 모든 것을 변경하지는 않았습니다. 이 옵션을 Response.Write에서 강제로 제거 할 수 있습니까? – bechbd

+0

PDF를 만든 후 Acrobat에서 엽니 다. 전체 화면 옵션이 선택되어 있습니까? –

+0

전체 버전의 Acrobat이 없으므로 볼 수 없습니다. 어떻게 든 Acrobat Reader에서 이것을 볼 수 있습니까? – bechbd

관련 문제