问题描述
我有一个API,该API返回PDF文档的URL网站字符串。我想在IFrame窗口中将PDF显示为嵌入式html,但是它无法正常工作会继续下载文档。如何解决?尝试修改http标头
(这是在我们的网络内,因此Iframe可以正常运行,没有跨源问题)
尝试将url字符串发送到我的iframe组件中
更新后,显示错误:configurations
API :
Failed to Load PDF Document.
IFrameComponent:
如下进行测试
export class ImageRetrievalService {
readonly baseUrl = `${environment.companyBaseUrl}/api/ImageRetrieval`;
constructor(private http: HttpClient) { }
getDocument(
documentId: number
): Observable<string> {
const url = `${this.baseUrl}/GetDocument/${documentId}/`;
return this.http
.get(url,{ responseType: 'text' })
.pipe(map((res) => res));
}
尝试的解决方案:
正在显示以下内容 错误:blob:http:// localhost:4200 / fba3513e-3b82-4c48-ad14-94ceed896342
无法加载PDF文档。
<div class="iframe-two">
<div class="box">
<iframe title="iframe-box1" class="iframe-area" [src]="url1 | safe"> </iframe>
</div>
<div class="box">
<iframe title="iframe-box2" class="iframe-area" [src]="url2 | safe"></iframe>
</div>
</div>
资源:
Opening PDF file in new tab angular 4?
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)